unit Kalku1;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls, Menus;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Edit1: TEdit;
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;
Button16: TButton;
Button17: TButton;
Button18: TButton;
Button19: TButton;
Button20: TButton;
PopupMenu1: TPopupMenu;
Kolor11: TMenuItem;
Kolor21: TMenuItem;
Standard1: TMenuItem;
Button21: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button8Click(Sender: TObject);
procedure Button12Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button9Click(Sender: TObject);
procedure Button11Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button10Click(Sender: TObject);
procedure Button16Click(Sender: TObject);
procedure Button13Click(Sender: TObject);
procedure Button15Click(Sender: TObject);
procedure Button14Click(Sender: TObject);
procedure Button17Click(Sender: TObject);
procedure Button18Click(Sender: TObject);
procedure Button19Click(Sender: TObject);
procedure Button20Click(Sender: TObject);
procedure Kolor11Click(Sender: TObject);
procedure Kolor21Click(Sender: TObject);
procedure Standard1Click(Sender: TObject);
procedure Button21Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;i:double;znak:char;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
showmessage('Autor JB Copyright 2003');
close;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
i:=0;
edit1.text:='0';
end;
procedure TForm1.Button7Click(Sender: TObject);
begin
edit1.text:=floattostr(strtofloat(edit1.text)*10);
end;
procedure TForm1.Button6Click(Sender: TObject);
begin
edit1.text:=floattostr(strtofloat(edit1.text)*10+1);
end;
procedure TForm1.Button8Click(Sender: TObject);
begin
edit1.text:=floattostr(strtofloat(edit1.text)*10+2);
end;
procedure TForm1.Button12Click(Sender: TObject);
begin
edit1.text:=floattostr(strtofloat(edit1.text)*10+3);
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
edit1.text:=floattostr(strtofloat(edit1.text)*10+4);
end;
procedure TForm1.Button9Click(Sender: TObject);
begin
edit1.text:=floattostr(strtofloat(edit1.text)*10+5);
end;
procedure TForm1.Button11Click(Sender: TObject);
begin
edit1.text:=floattostr(strtofloat(edit1.text)*10+6);
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
edit1.text:=floattostr(strtofloat(edit1.text)*10+7);
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
edit1.text:=floattostr(strtofloat(edit1.text)*10+8);
end;
procedure TForm1.Button10Click(Sender: TObject);
begin
edit1.text:=floattostr(strtofloat(edit1.text)*10+9);
end;
procedure TForm1.Button16Click(Sender: TObject);
begin
if i=0 then i:=strtofloat(edit1.text)
else
i:=strtofloat(edit1.text);
edit1.text:='0';
znak:='+';
end;
procedure TForm1.Button13Click(Sender: TObject);
begin
if i=0 then i:=strtofloat(edit1.text)
else
i:=strtofloat(edit1.text);
edit1.text:='0';
znak:='*';
end;
procedure TForm1.Button15Click(Sender: TObject);
begin
if i=0 then i:=strtofloat(edit1.text)
else
i:=strtofloat(edit1.text);
edit1.text:='0';
znak:='-';
end;
procedure TForm1.Button14Click(Sender: TObject);
label et;
begin
if znak='+' then begin
edit1.text:=floattostr(i+strtofloat(edit1.text));
i:=strtofloat(edit1.text);
end;
if znak='-' then begin
edit1.text:=floattostr(i-strtofloat(edit1.text));
i:=strtofloat(edit1.text);
end;
if znak='*' then begin
edit1.text:=floattostr(i*strtofloat(edit1.text));
i:=strtofloat(edit1.text);
end;
if (znak='/') and (edit1.text<>'0') then begin
edit1.text:=floattostr(i/strtofloat(edit1.text));
i:=strtofloat(edit1.text);
end;
if (znak='/') and (edit1.text='0') then begin
edit1.text:='Błąd. Nieskończoność' ;
i:=0; goto et;
end;
i:=strtofloat(edit1.text);
et:
end;
procedure TForm1.Button17Click(Sender: TObject);
begin
edit1.text:=floattostr(strtofloat(edit1.text)*(-1));
end;
procedure TForm1.Button18Click(Sender: TObject);
begin
if i=0 then i:=strtofloat(edit1.text)
else
i:=strtofloat(edit1.text);
edit1.text:='0';
znak:='/';
end;
procedure TForm1.Button19Click(Sender: TObject);
begin
edit1.text:=floattostr(strtofloat(edit1.text)* 0.1);
end;
procedure TForm1.Button20Click(Sender: TObject);
begin
edit1.text:=floattostr(strtofloat(edit1.text)/100);
end;
procedure TForm1.Kolor11Click(Sender: TObject);
begin
form1.color:=clred;
end;
procedure TForm1.Kolor21Click(Sender: TObject);
begin
form1.color:=clyellow;
end;
procedure TForm1.Standard1Click(Sender: TObject);
begin
form1.color:=clgray;
end;
procedure TForm1.Button21Click(Sender: TObject);
begin
................................................................................
.......................??
end
end.
Witam, mam problem ponieważ nie potrafię napisać kawałka kodu. Mianowicie na pierwiastek kwadratowy. Szukam już dobrą chwilę ale nigdzie nie potrafię tego znaleźć albo zastosować;/ Pomoże ktoś?
dziekuje juz sobie poradzilem