Unit Jisuanqiu;
Interface
Uses Windows, Messages, Sysutils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Stdctrls, ExtCtrls
type TForm1 = class (TForm) Button1: TButton; Button2: TButton; Button3: TButton; Button4: TButton; Button5: TButton; Button6: TButton; Button7: TButton; Button8: TButton; Button9: TButton; Button10: TButton; Button11: TButton ; Button12: TButton; Button13: TButton; Button14: TButton; Button15: TButton; Panel1: TPanel; Edit1: TEdit; Button17: TButton; Button16: TButton; 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); procedure Button9Click ( Sender: TObject); procedure Button10Click (Sender: TObject); procedure Button12Click (Sender: TObject); procedure Button13Click (Sender: TObject); procedure Button14Click (Sender: TObje ct); procedure Button15Click (Sender: TObject); procedure Button17Click (Sender: TObject); procedure Button16Click (Sender: TObject); procedure Button11Click (Sender: TObject); private {Private declarations} public {Public declarations} end;
VAR FORM1: TFORM1; J, I, Num, Num1, Num2: Integer; S: String; Implementation
{$ R * .dfm}
Procedure TFORM1.BUTTON1CLICK (Sender: TOBJECT); Beginif i <> 1 Thenbegin if (edit1.text = ' ') or (edit1.text = 'x') or (Edit1) OR (Edit1. Text = '/') Then Begin Edit1.Text: = '; edit1.text: = Edit1.Text Button1.caption; Else Edit1.Text: = Edit1.Text Button1.caption; Else Begin Edit1.Text : = '; Edit1.text: = edit1.text button1.caption; end; end; procedure tform1.button2click (sender: TOBJECT); Beginif i <> 1 damEgin if (edit1.text =' ') OR Edit1.text = '-') or (edit1.text = 'x') or (edit1.text = '/') Then Begin Edit1.Text: = '; edit1.text: = Edit1.Text Button2.caption END ELSE edit1.text: = edit1.text button2.caption; end else begin edit1.text: = '; edit1.text: = Edit1.Text Button2.caption; end; end; procedure tForm1.button3click (sender : TOBJECT); Beginif i <> 1 THENBEGIN IF (edit1.text = ' ') or (edit1.text = 'x') or (edit1.text = '/') Then Begin Edit1.Text: = '; Edit1.Text: = Edit1.Text Button3.caption; end else edit1.text: = edit1.text button3.caption; end else begin edit1.text: = '; edit1.text: = Edit1.Text Button3.caption; end;
Procedure TForm1.Button4Click (Sender: Tobject); Beginif i <> 1 thenbegin if (edit1.text = ' ') or (edit1.text = 'x') or (Edit1) OR (Edit1. Text = '/') Then Begin Edit1.text: = '; edit1.text: = Edit1.Text Button4.caption; end else edit1.text: = Edit1.Text Button4.caption; Else Begin Edit1.Text : = '; Edit1.text: = Edit1.text Button4.caption; end; end; procedure tform1.button5click (sender: TOBJECT); Beginif i <> 1 damEgin if (Edit1.Text =' ') OR Edit1.text = '-') or (edit1.text = 'x') or (edit1.text = '/') Then Begin Edit1.Text: = '; edit1.text: = Edit1.Text Button5.caption ELSE edit1.text: = edit1.text button5.caption; end else begin edit1.text: = '; edit1.text: = Edit1.Text Button5.caption; end;
Procedure TForm1.Button6Click (Sender: TOBJECT); Beginif i <> 1 thenbegin if (edit1.text = ' ') or (edit1.text = 'x') or (edit1. TEXT = '/') Then Begin Edit1.Text: = '; edit1.text: = Edit1.Text Button6.caption; end else edit1.text: = Edit1.Text Button6.caption; end else begin edit1.text : = '; Edit1.text: = Edit1.text Button6.caption; end;
Procedure TFORM1.BUTTON7CLICK (Sender: TOBJECT); Beginif i <> 1 thenbegin if (edit1.text = ' ') or (edit1.text = 'x') OR (Edit1. Text = '/') Then Begin Edit1.Text: = '; Edit1.Text: = Edit1.Text Button7.caption; end else edit1.text: = Edit1.Text Button7.caption; end else begin Edit1.Text : = '; Edit1.Text: = Edit1.Text Button7.caption; end; end; procedure tform1.button8click (sender: TOBJECT); Beginif i <> 1 damEgin if (edit1.text =' ') OR Edit1.text = '-') OR (edit1.text = 'x') or (edit1.text = '/') Then Begin Edit1.text: = '; edit1.text: = Edit1.Text Button8.caption ELSE edit1.text: = edit1.text button8.caption; end else begin edit1.text: = '; edit1.text: = Edit1.Text Button8.caption; end;
Procedure TForm1.Button9Click (Sender: Tobject); Beginif i <> 1 thenbegin if (edit1.text = '-') or (edit1.text = 'x') or (Edit1) OR (Edit1. Text = '/') Then Begin Edit1.Text: = '; Edit1.Text: = Edit1.Text Button9.caption; Else Edit1.Text: = Edit1.Text Button9.caption; Else Begin Edit1.Text : = ''; Edit1.text: = Edit1.text Button9.caption; end;
Procedure TForm1.Button10Click (Sender: Tobject); BeginiF i <> 1 thenbegin if (edit1.text = ' ') or (edit1.text = 'x') or (Edit1) OR (Edit1. Text = '/') Then Begin Edit1.Text: = '; edit1.text: = Edit1.Text Button10.caption; end else edit1.text: = Edit1.Text Button10.caption; Else Begin Edit1.Text : = ''; Edit1.text: = Edit1.Text Button10.caption; end;
Procedure TForm1.Button12Click (Sender: TOBJECT); begin if (edit1.text = '-') or (edit1.text = 'x') or (edit1.text = '/') Then Begin Edit1.Text: = ' '; S: =' '; end else begin num1: = start (edit1.text); Num: = Num1; edit1.text: =' '; s: =' '; end; {IF (Edit1. Text = '-') or (edit1.text = 'x') or (edit1.text = '/') THEN BEGIN NUM1: = J; Edit1.Text: = ' '; s: = ' '; END Else Begin IF J = STRTOINT (Edit1.Text) THEN BEGINT (EDIT1.TEXT); J: = Num1; Edit1.Text: = ' '; s: = ' '; Else Begin Num2: = STRTOINT (EDIT1.TEXT); if (s = ' ') or (s = 'x') or (s = '/') THEN BEGIN IF (S = ' ') THEN Begin Num: = J Num2; edit1.text: = INTOSTR (NUM); // j end; if (s = '-') THEN BEGIN NUM: = J-Num2; Edit1.Text: = INTOSTR (NUM); End; if (s = 'x') THEN Begin Num: = j * Num2; Edit1.Text: = INTOSTR (NUM); END; IF (s = '/') THEN BEGIN NUM: = J Div Num2; Edit1.Text: = INTOSTR (NUM); end; end; // i: = 1; End; end;
Procedure TForm1.Button13Click (sender: TOBJECT); begin if (edit1.text = ' ') or (edit1.text = 'x') or (edit1.text = '/') Then Begin Edit1.Text: = '- '; S: =' - '; END ELSE BEGIN NUM1: = STRTOINT (Edit1.Text); Num: = Num1; Edit1.Text: =' - '; s: =' - '; end; end; procedure tform1. Button14Click (Sender: TOBJECT); begin if (edit1.text = '-') or (edit1.text = ' ') or begin edit1.text: = 'x'; s : = 'X'; END ELSE BEGIN NUM1: = STRTOINT (Edit1.Text); Num: = Num1; Edit1.Text: = 'x'; s: = 'x'; end; end;
Procedure TForm1.Button15Click (sender: TOBJECT); begin if (edit1.text = '-') or (edit1.text = ') or (edit1.text =' ') Then Begin Edit1.Text: =' / '; S: =' / '; end else begin num1: = start (edit1.text); Num: = Num1; Edit1.Text: =' / '; s: =' / '; end; end;
Procedure TFORM1.BUTTON17Click (Sender: TOBJECT); beginclose;
Procedure TFORM1.BUTTON16CLICK (Sender: TOBJECT); beginedit1.text: = '; end;
Procedure TForm1.Button11Click (Sender: TOBJECT); Begin Num2: = StrtOINT (Edit1.Text); if (s = ' ') or (s = '-') or (s = ') OR / ') THENBEGIN IF (S =' ') THEN BEGIN NUM: = Num1 Num2; Edit1.Text: = INTOSTOSTR (NUM); END; IF (S =' - ') THEN BEGIN NUM: = Num1-Num2; Edit1.text: = INTOSTR (NUM); End; if (s = 'x') THEN BEGIN NUM: = Num1 * Num2; Edit1.Text: = INTOSTR (NUM); END; if (s = '/') THEN Begin Num: = Num1 Div Num2; Edit1.Text: = INTOSTR (NUM); END; END; I: = 1; End; End.