unit Unit1; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Cislo: TButton; Button1: TButton; Button2: TButton; Button3: TButton; Button4: TButton; Button5: TButton; Button6: TButton; Button7: TButton; Button8: TButton; Button9: TButton; Button10: TButton; Dis: TLabel; Opera: TButton; Button11: TButton; Button12: TButton; Button13: TButton; Button14: TButton; OST: TButton; Button15: TButton; Button16: TButton; Button17: TButton; Button18: TButton; Button19: TButton; procedure FormCreate(Sender: TObject); procedure CisloClick(Sender: TObject); procedure OperaClick(Sender: TObject); procedure OSTClick(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; COper:integer; Smaz:boolean; Minuly:string; implementation {$R *.DFM} procedure TForm1.FormCreate(Sender: TObject); begin Dis.caption:='';Minuly:=''; COper:=-1;Smaz:=False; end; procedure TForm1.CisloClick(Sender: TObject); begin if Smaz then dis.caption:=''; Smaz:=false; dis.caption:=dis.caption+(sender as tbutton).caption; end; procedure TForm1.OperaClick(Sender: TObject); Var s:string; a,b,c:double; begin s:=(sender as tbutton).caption; smaz:=true; If COper<>-1 then begin a:=strtofloat(minuly); b:=strtofloat(dis.caption); if Coper=1 then c:=a+b else if Coper=2 then c:=a-b else if Coper=3 then c:=a*b else if Coper=4 then c:=a/b; Dis.Caption:=floattostr(c); End; if s='+' then COper:=1 else if s='-' then COper:=2 else if s='*' then COper:=3 else if s='/' then COper:=4 else COper:=-1; Minuly:=Dis.caption; end; procedure TForm1.OSTClick(Sender: TObject); var s:string; begin s:=(sender as tbutton).caption; If s='Ce' then dis.caption:='' else if s='AC' then begin Dis.caption:='';COper:=-1;End else if s='v--' then Begin dis.caption:=floattostr(sqrt(strtofloat(dis.caption)));Smaz:=True;End else if s='Sin' then Begin dis.caption:=floattostr(sin(strtofloat(dis.caption)));Smaz:=True;End else if s='Cos' then Begin dis.caption:=floattostr(cos(strtofloat(dis.caption)));Smaz:=True;End else if s='Tan' then Begin dis.caption:=floattostr(sin(strtofloat(dis.caption))/cos(strtofloat(dis.caption)));Smaz:=True;End; end; end.