Kod: Kodu kopyalamak için üzerine çift tıklayın!
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, XPMan;
type
TForm1 = class(TForm)
GroupBox1: TGroupBox;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Button1: TButton;
Button2: TButton;
Label1: TLabel;
Button3: TButton;
Label2: TLabel;
Button4: TButton;
Button5: TButton;
Button6: TButton;
Button7: TButton;
Button8: TButton;
Button9: TButton;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
XPManifest1: TXPManifest;
procedure Button1Click(Sender: TObject);
Function Hesapla(Sayi_1,Sayi_2:String):String;
Function FormatString(Yazi:String):String;
Function WriteOutput(Rakam:Integer):String;
Function RemoveExcessZeros(Yazi:String):String;
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 FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
Sayi : String;
implementation
{$R *.dfm}
Function TForm1.Hesapla(Sayi_1,Sayi_2:String):String;
Var
Birinci_Sayi : Array[1..100] Of Char;
Ikinci_Sayi : Array[1..100] Of Char;
Sayi_1_Uzunlugu : Integer;
Sayi_2_Uzunlugu : Integer;
x,y,z : Integer;
Deger_1,Deger_2 : Integer;
Alt_Toplam : Integer;
Yazi_1 : String;
Yazi_2 : String;
Ara_Toplam : Integer;
Yazi_3 : String;
Begin
Result:='';
Sayi:='';
Yazi_3:='';
Sayi_1_Uzunlugu:=0;
Sayi_2_Uzunlugu:=0;
Deger_1:=0;
Deger_2:=0;
Alt_Toplam:=0;
Sayi_1:=FormatString(Sayi_1);
Sayi_2:=FormatString(Sayi_2);
Sayi_1_Uzunlugu:=Length(Sayi_1);
Sayi_2_Uzunlugu:=Length(Sayi_2);
Yazi_1:='';
Yazi_2:='';
Yazi_1:=Sayi_1;
Yazi_2:=Sayi_2;
For x:=100 DownTo 1 Do Birinci_Sayi[x]:=Yazi_1[x];
For y:=100 DownTo 1 Do Ikinci_Sayi[y]:=Yazi_2[y];
Ara_Toplam:=0;
For z:=100 DownTo 1 Do
Begin
Deger_1:=StrToInt(Birinci_Sayi[z]);
Deger_2:=StrToInt(Ikinci_Sayi[z]);
Alt_Toplam:=Deger_1+Deger_2;
If Ara_Toplam>0 Then Begin
Alt_Toplam:=Alt_Toplam+Ara_Toplam;
Ara_Toplam:=0;
End;
If Alt_Toplam>9 Then Begin
Ara_Toplam:=0;
Yazi_3:='';
Ara_Toplam:=Alt_Toplam;
Yazi_3:=IntToStr(Alt_Toplam);
Result:=WriteOutput(StrToInt(Yazi_3[2]));
Ara_Toplam:=StrToInt(Yazi_3[1]);
End
Else Result:=WriteOutput(Alt_Toplam);
End;
Result:=RemoveExcessZeros(Result);
End;
Function TForm1.FormatString(Yazi:String):String;
Var
Hane_No : Integer;
Begin
Result:='';
For Hane_No:=1 To 100-Length(Yazi) Do Yazi:='0'+Yazi;
Result:=Yazi;
End;
Function TForm1.WriteOutput(Rakam:Integer):String;
Begin
Result:='';
Sayi:=IntToStr(Rakam)+Sayi;
Result:=Sayi;
End;
Function TForm1.RemoveExcessZeros(Yazi:String):String;
Var
Yeni_Yazi : String;
Load : Boolean;
Hane_No : Integer;
Begin
Result:='';
Yeni_Yazi:='';
Load:=False;
For Hane_No:=1 To Length(Yazi) Do
Begin
If Yazi[Hane_No]<>'0' Then Load:=True;
If Load=False Then Begin
If Yazi[Hane_No]<>'0' Then Load:=True;
End
Else Yeni_Yazi:=Yeni_Yazi+Yazi[Hane_No];
End;
Result:=Yeni_Yazi;
End;
procedure TForm1.Button1Click(Sender: TObject);
var
a,b,c:real48;
begin
a:=strtofloat(edit1.Text);
b:=strtofloat(edit2.Text);
c:=a+b;
edit3.Text:=floattostr(c)
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
label1.Caption:=Hesapla(edit1.Text,edit2.Text);
end;
procedure TForm1.Button3Click(Sender: TObject);
var
z:integer;
k,y,x:string;
begin
if (length(edit3.Text))=2 then
begin
z:=length(edit3.Text);
x:=edit3.Text;
y:=copy(x,z-1,2);
label2.Caption:='0'+','+y;
k:=edit1.Text;
delete(k,z-1,2);
edit1.Text:=k;
end;
end;
procedure TForm1.Button4Click(Sender: TObject);
var
z:integer;
a,k,y,x:string;
begin
if (length(edit3.Text))=3 then
begin
z:=length(edit3.Text);
x:=edit3.Text;
y:=copy(x,z-1,2);
delete(k,z-1,2);
a:=copy(x,z-2,1);
label2.Caption:=a+','+y;
end;
end;
procedure TForm1.Button5Click(Sender: TObject);
var
z:integer;
a,k,y,x:string;
begin
if (length(edit3.Text))=4 then
begin
z:=length(edit3.Text);
x:=edit3.Text;
y:=copy(x,z-1,2);
delete(k,z-1,2);
a:=copy(x,z-3,2);
label2.Caption:=a+','+y;
end;
end;
procedure TForm1.Button6Click(Sender: TObject);
var
z:integer;
a,k,y,x:string;
begin
if (length(edit3.Text))=5 then
begin
z:=length(edit3.Text);
x:=edit3.Text;
y:=copy(x,z-1,2);
delete(k,z-1,2);
a:=copy(x,z-4,3);
label2.Caption:=a+','+y;
end;
end;
procedure TForm1.Button7Click(Sender: TObject);
var
z:integer;
ff,aa,a,k,y,x:string;
begin
if (length(edit3.Text))=6 then
begin
aa:=',';
z:=length(edit3.Text);
x:=edit3.Text;
y:=copy(x,z-1,2);
delete(k,z-1,2);
a:=copy(x,z-5,4);
label2.Caption:=a+','+y;
ff:=label2.Caption;
insert(aa,ff,2);
label2.Caption:=ff;
end;
end;
procedure TForm1.Button8Click(Sender: TObject);
var
z:integer;
ff,aa,a,k,y,x:string;
begin
if (length(edit3.Text))=8 then
begin
aa:=',';
z:=length(edit3.Text);
x:=edit3.Text;
y:=copy(x,z-1,2);
delete(k,z-1,2);
a:=copy(x,z-7,6);
label2.Caption:=a+','+y;
ff:=label2.Caption;
insert(aa,ff,4);
label2.Caption:=ff;
end;
end;
procedure TForm1.Button9Click(Sender: TObject);
var
z:integer;
ff,aa,a,k,y,x:string;
begin
if (length(edit3.Text))=7 then
begin
aa:=',';
z:=length(edit3.Text);
x:=edit3.Text;
y:=copy(x,z-1,2);
delete(k,z-1,2);
a:=copy(x,z-6,5);
label2.Caption:=a+','+y;
ff:=label2.Caption;
insert(aa,ff,3);
label2.Caption:=ff;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
label1.Hide;
end;