Home > Back-end >  Beginners Delphi for your guidance
Beginners Delphi for your guidance

Time:10-11

I just study Delphi, I want to ask, how to do when calculated and/or difference between two Numbers, another button button will pop up right and wrong when pressing the tip

CodePudding user response:

Said don't understand what you mean

CodePudding user response:

 
Var
A, b, c: integer;
Beigin
A:=100;
B:=200;
C:=300;
If (a + b=300) then
ShowMessage (' correct ')
The else
ShowMessage (' error ');
end;

CodePudding user response:

If (a + b=c) then
ShowMessage (' correct ')
The else
ShowMessage (' error ');

CodePudding user response:

This is to ask?

CodePudding user response:

It was new, the problem of egg teng, the CSDN this year is the most easy questions,,,

CodePudding user response:

Thank you so much.

CodePudding user response:

The above people had said, and post it for you,,

CodePudding user response:

Now that is a novice, this problem is not the egg pain,

CodePudding user response:

Question you, by the way, what are the books for the beginner, recommend, thank you!

CodePudding user response:

Search "Delphi5 developer's guide" the PDF of the book, a text version of

CodePudding user response:

Thank you for your attention!

CodePudding user response:

A lot of books here! And they were afraid to look up!

CodePudding user response:

Is also a novice, comfort each other, this kind of question to find the basis of books to read

CodePudding user response:

The
reference 3 floor sololie response:
if (a + b=c) then
ShowMessage (' correct ')
The else
ShowMessage (' error ');

Not a + b==c?

CodePudding user response:

You should be doing similar web calculate mouth, or something!
Is bulk, if the set value every box, a value, then comparing and fill in the book it was!

CodePudding user response:

 
The unit Unit1;

Interface

USES the
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

Type
TForm1=class (TForm)
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Label3: TLabel;
Label4: TLabel;
Edit4: TEdit;
For: TButton;
Procedure FormCreate (Sender: TObject);
Procedure Button1Click (Sender: TObject);
Private
{Private declarations}
Public
{Public declarations}
end;

Var
Form1: TForm1;

Implementation
USES Math and types;
{$R *. DFM}

Procedure TForm1. Button1Click (Sender: TObject);
Var
A, b, c, d: double;
The begin
A:=StrTointDef (Edit1. Text, 0);//value of 1
B:=StrTointDef (Edit2. Text, 0);//2
C:=StrTointDef (Edit3. Text, 0);//the sum of two Numbers
D:=StrTointDef (Edit4. Text, 0);//the difference between the two Numbers
If (CompareValue (a + b, c) & lt;> Then EqualsValue)
The begin
ShowMessage (' the sum of two Numbers is not correct, correct value as' + floatTOStr (a + b));
The Exit;
end;

If (CompareValue (a - b, d) & lt;> Then EqualsValue)
The begin
ShowMessage (' the difference between the two Numbers is not correct, the correct value as' + floatToStr (a - b));
The Exit;
end;
Randomize.
Edit1. Text:=IntToStr (random (100));
Edit2. Text:=IntToStr (random (100));
Edit3. Text:=' ';
Edit4. Text:=' ';
end;

Procedure TForm1. FormCreate (Sender: TObject);
The begin
Edit1. Text:=' ';
Edit2. Text:=' ';
Edit3. Text:=' ';
Edit4. Text:=' ';
Randomize.
Edit1. Text:=IntToStr (random (100));
Edit2. Text:=IntToStr (random (100));
end;

End.

CodePudding user response:

First look at basic knowledge,,,
  • Related