|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Label1: TLabel;
Label2: TLabel;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Button6: TButton;
Button7: TButton;
Button8: TButton;
procedure Edit1Click(Sender: TObject);
procedure Edit2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
procedure Button8Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Edit1Click(Sender: TObject);
begin
Edit1.Text := '';
end;
procedure TForm1.Edit2Click(Sender: TObject);
begin
Edit2.Text := '';
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
label1.Caption:= '+';
Edit3.Text:= FloatToStr(StrToFloat(Edit1.Text) + StrToFloat(Edit2.Text));
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Label1.Caption:= '-';
Edit3.Text:= FloatToStr(StrToFloat(Edit1.Text) - StrToFloat(Edit2.Text));
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
Label1.Caption := '*';
Edit3.Text := FloatToStr(StrToFloat(Edit1.Text ) * StrToFloat(Edit2.Text ));
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
Label1.Caption := '/';
Edit3.Text :=FloatToStr(StrToFloat(Edit1.Text ) / StrToFloat(Edit2.Text ));
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
Label1.Caption := 'And';
Edit3.Text :=IntToStr(StrToInt(Edit1.Text ) And StrToInt(Edit2.Text ));
end;
procedure TForm1.Button6Click(Sender: TObject);
begin
Label1.Caption := 'Not';
Edit3.Text :=IntToStr(StrToInt(Edit1.Text ) Not StrToInt(Edit2.Text )); /// unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Label1: TLabel;
Label2: TLabel;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Button6: TButton;
Button7: TButton;
Button8: TButton;
procedure Edit1Click(Sender: TObject);
procedure Edit2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
procedure Button8Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Edit1Click(Sender: TObject);
begin
Edit1.Text := '';
end;
procedure TForm1.Edit2Click(Sender: TObject);
begin
Edit2.Text := '';
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
label1.Caption:= '+';
Edit3.Text:= FloatToStr(StrToFloat(Edit1.Text) + StrToFloat(Edit2.Text));
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Label1.Caption:= '-';
Edit3.Text:= FloatToStr(StrToFloat(Edit1.Text) - StrToFloat(Edit2.Text));
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
Label1.Caption := '*';
Edit3.Text := FloatToStr(StrToFloat(Edit1.Text ) * StrToFloat(Edit2.Text ));
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
Label1.Caption := '/';
Edit3.Text :=FloatToStr(StrToFloat(Edit1.Text ) / StrToFloat(Edit2.Text ));
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
Label1.Caption := 'And';
Edit3.Text :=IntToStr(StrToInt(Edit1.Text ) And StrToInt(Edit2.Text ));
end;
procedure TForm1.Button6Click(Sender: TObject);
begin
Label1.Caption := 'Not';
Edit3.Text :=IntToStr(StrToInt(Edit1.Text ) Not StrToInt(Edit2.Text )); //出错的是这句!
end;
procedure TForm1.Button7Click(Sender: TObject);
begin
Label1.Caption := 'Xor';
Edit3.Text :=IntToStr(StrToInt(Edit1.Text ) Xor StrToInt(Edit2.Text ));
end;
procedure TForm1.Button8Click(Sender: TObject);
begin
Label1.Caption := 'Or';
Edit3.Text :=IntToStr(StrToInt(Edit1.Text ) Or StrToInt(Edit2.Text ));
end;
end.
end;
procedure TForm1.Button7Click(Sender: TObject);
begin
Label1.Caption := 'Xor';
Edit3.Text :=IntToStr(StrToInt(Edit1.Text ) Xor StrToInt(Edit2.Text ));
end;
procedure TForm1.Button8Click(Sender: TObject);
begin
Label1.Caption := 'Or';
Edit3.Text :=IntToStr(StrToInt(Edit1.Text ) Or StrToInt(Edit2.Text ));
end;
end.
对位运算符没有理解
|
|