Home > Back-end >  According to wrong calculation?
According to wrong calculation?

Time:09-19

The unit Unit2.

Interface

USES the
System. The SysUtils, System. The Types, System. UITypes, System. Classes, System. Variants,
FMX Types, FMX Controls, FMX. Forms, FMX. Graphics, FMX. Dialogs, FMX. StdCtrls,
FMX. Controls. The Presentation, FMX. Edit;

Type
TForm2=class (TForm)
First: TEdit;
Second: TEdit;
For: TButton;
Third: TEdit;
Procedure Button1Click (Sender: TObject);
Private
{Private declarations}
Public
{Public declarations}
end;

Var
Form2: TForm2;

Implementation

{$R *. FMX}

Procedure TForm2. Button1Click (Sender: TObject);
Var

First: integer;
Second: integer;

The begin
Third. Text:=intToStr (first and second);

end;

CodePudding user response:

 
Procedure TForm2. Button1Click (Sender: TObject);
The begin
Third. Text:=inttostr (strtointdef (first. Text, 0) + strtointdef (second. Text, 0));
end;

CodePudding user response:

Works fine. Thankyou, but it looks like very complicated!

CodePudding user response:

According to the division doesn 't work when I put the home (/) (+)?

CodePudding user response:

To study Delphi foundation, look at other people's code, don't ask questions,

CodePudding user response:

The
refer to the original poster weixin_39376810 response:
unit Unit2.

Interface

USES the
System. The SysUtils, System. The Types, System. UITypes, System. Classes, System. Variants,
FMX Types, FMX Controls, FMX. Forms, FMX. Graphics, FMX. Dialogs, FMX. StdCtrls,
FMX. Controls. The Presentation, FMX. Edit;

Type
TForm2=class (TForm)
First: TEdit;
Second: TEdit;
For: TButton;
Third: TEdit;
Procedure Button1Click (Sender: TObject);
Private
{Private declarations}
Public
{Public declarations}
end;

Var
Form2: TForm2;

Implementation

{$R *. FMX}

Procedure TForm2. Button1Click (Sender: TObject);
Var

First: integer;
Second: integer;

The begin
Third. Text:=intToStr (first and second);

end;


Put data type, control type and so on to understand, or to read routines, make it clear what routines are again ~ ~ ~

CodePudding user response:

Online search denphi run-time error table, according to the prompt error mean to screen, so that you learn something more solid · · · · · ·

CodePudding user response:

This is no basis for ha,

First: TEdit;
Second: TEdit;
  • Related