Anasayfa > Kodlar > Delphi’de hesap makinası yapmak

Delphi’de hesap makinası yapmak

Bolme harici diger fonksiyonlar calısıyor fakat bolmedeki sorunu bulabilirmisiniz arkadaslar

unit unit25;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, DBTables, StdCtrls;

type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Button41: TButton;
Button42: TButton;
Button43: TButton;
Button44: TButton;
Button45: TButton;
Button46: TButton;
Button47: TButton;
Button48: TButton;
Button40: TButton;
Button49: TButton;
ListBox1: TListBox;
Button50: TButton;
Button60: TButton;
procedure Button41Click(Sender: TObject);
procedure Button42Click(Sender: TObject);
procedure Button43Click(Sender: TObject);
procedure Button44Click(Sender: TObject);
procedure Button45Click(Sender: TObject);
procedure Button46Click(Sender: TObject);
procedure Button47Click(Sender: TObject);
procedure Button48Click(Sender: TObject);
procedure Button49Click(Sender: TObject);
procedure Button40Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button50Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button60Click(Sender: TObject);

{ Private declarations }
public

private
{ Public declarations }

end;
var
b:boolean;
r,t,e:real;
islem:string;
dizi:array[1..20] of real;
counter:integer;
var
Form1: TForm1;

function topla(dizi:array of real;counter:integer):real;
function car(dizi:array of real;counter:integer):real;
function cik(dizi:array of real;counter:integer):real;
function bol(dizi:array of real;counter:integer):real;
implementation

{$R *.dfm}

function topla(dizi:array of real;counter:integer):real;
begin

dizi[counter]:=strtofloat ( form1.edit1.text);
repeat

t:=t+dizi[counter];
counter:=counter-1;
until(counter<1);
form1.Edit1.Text:=floattostr(t);
end;

function car(dizi:array of real;counter:integer):real;
begin
dizi[counter]:=strtofloat ( form1.edit1.text);
t:=1;
repeat

t:=t*dizi[counter];
counter:=counter-1;
until(counter<1);
form1.Edit1.Text:=floattostr(t);
end;
function cik(dizi:array of real;counter:integer):real;
begin
t:=0;
dizi[counter]:=strtofloat ( form1.edit1.text);
repeat
t:=t+dizi[counter];
counter:=counter-1;
until(counter<2);
t:=dizi[1]-t;
form1.Edit1.Text:=floattostr(t);
end;

function bol(dizi:array of real;counter:integer):real;
var
i:integer;
j:real;

begin
dizi[counter]:=strtofloat ( form1.edit1.text);
i:=counter;
t:=dizi[1];
dizi[counter]:=strtofloat ( form1.edit1.text);
i:=2;
while i<= counter do
begin

j:=dizi[i];
t:=(t)/(j);
i:=i+1;
counter:=counter-1;
end;

form1.Edit1.Text:=floattostr(t);
end;
procedure TForm1.Button41Click(Sender: TObject);
begin
edit1.Text:=edit1.Text+floattostr(1);
end;

procedure TForm1.Button42Click(Sender: TObject);
begin
edit1.Text:=edit1.Text+floattostr(2);
end;

procedure TForm1.Button43Click(Sender: TObject);
begin
edit1.Text:=edit1.Text+floattostr(3);
end;

procedure TForm1.Button44Click(Sender: TObject);
begin
edit1.Text:=edit1.Text+floattostr(4);
end;

procedure TForm1.Button45Click(Sender: TObject);
begin
edit1.Text:=edit1.Text+floattostr(5);
end;

procedure TForm1.Button46Click(Sender: TObject);
begin
edit1.Text:=edit1.Text+floattostr(6);
end;

procedure TForm1.Button47Click(Sender: TObject);
begin
edit1.Text:=edit1.Text+floattostr(7);
end;

procedure TForm1.Button48Click(Sender: TObject);
begin
edit1.Text:=edit1.Text+floattostr(8);
end;

procedure TForm1.Button49Click(Sender: TObject);
begin
edit1.Text:=edit1.Text+floattostr(9);
end;

procedure TForm1.Button40Click(Sender: TObject);
begin
edit1.Text:=edit1.Text+floattostr(0);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
islem:='+';
counter:=counter+1;
dizi[counter]:=strtofloat(edit1.Text);
edit1.Text:=";

end;

procedure TForm1.Button3Click(Sender: TObject);
begin
islem:='*';
counter:=counter+1;
dizi[counter]:=strtofloat(edit1.Text);
edit1.Text:=";

end;

procedure TForm1.Button2Click(Sender: TObject);
begin
islem:='-';
counter:=counter+1;
dizi[counter]:=strtofloat(edit1.Text);

edit1.Text:=";

end;

procedure TForm1.Button4Click(Sender: TObject);
begin
islem:='/';
dizi[counter]:=(strtofloat(Edit1.Text));
counter:=counter+1;
edit1.Text:=";

end;

procedure TForm1.Button50Click(Sender: TObject);
begin
if button60.CanFocus then b:=true;
if b then edit1.Text:=edit1.Text+',';
b:=false;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
b := true;
counter:=1;
end;

procedure TForm1.Button5Click(Sender: TObject);
begin

//dizi[counter]:=strtofloat(edit1.Text);
if islem ='+' then
(topla(dizi,counter));

if islem ='*' then
(car(dizi,counter));
if islem ='-' then

(cik(dizi,counter));
if islem ='/' then
(bol(dizi,counter));
counter:=1;

end;

procedure TForm1.Button60Click(Sender: TObject);
var i:integer;
begin
edit1.Text:=";
b:=true;
for i:=0 to 20 do dizi[i]:=0;
counter:=1;
end;

end.


TD Software


  1. Henüz yorum yapılmamış.
  1. No trackbacks yet.

Bir Cevap Yazın

Aşağıya bilgilerinizi girin veya oturum açmak için bir simgeye tıklayın:

WordPress.com Logosu

WordPress.com hesabınızı kullanarak yorum yapıyorsunuz. Log Out / Değiştir )

Twitter resmi

Twitter hesabınızı kullanarak yorum yapıyorsunuz. Log Out / Değiştir )

Facebook fotoğrafı

Facebook hesabınızı kullanarak yorum yapıyorsunuz. Log Out / Değiştir )

Google+ fotoğrafı

Google+ hesabınızı kullanarak yorum yapıyorsunuz. Log Out / Değiştir )

Connecting to %s

%d blogcu bunu beğendi: