Amaliy qism:
#include
#pragma hdrstop
#include
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
int a,b,c;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
if (Label1->Caption=="0")
{Label1->Caption="9";}
else {Label1->Caption=Label1->Caption+"9"; }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
if (Label1->Caption=="0")
{Label1->Caption="8";}
else {Label1->Caption=Label1->Caption+"8"; }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button3Click(TObject *Sender)
{
if (Label1->Caption=="0")
{Label1->Caption="7";}
else {Label1->Caption=Label1->Caption+"7";
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button6Click(TObject *Sender)
{
if (Label1->Caption=="0")
{Label1->Caption="6";}
else {Label1->Caption=Label1->Caption+"6";
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button4Click(TObject *Sender)
{
if (Label1->Caption=="0")
{Label1->Caption="5";}
else {Label1->Caption=Label1->Caption+"5";
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button5Click(TObject *Sender)
{
if (Label1->Caption=="0")
{Label1->Caption="4";}
else {Label1->Caption=Label1->Caption+"4";
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button7Click(TObject *Sender)
{
if (Label1->Caption=="0")
{Label1->Caption="3";}
else {Label1->Caption=Label1->Caption+"3";
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button8Click(TObject *Sender)
{
if (Label1->Caption=="0")
{Label1->Caption="2";}
else {Label1->Caption=Label1->Caption+"2";
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button9Click(TObject *Sender)
{
if (Label1->Caption=="0")
{Label1->Caption="1";}
else {Label1->Caption=Label1->Caption+"1";
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button10Click(TObject *Sender)
{
if (Label1->Caption=="0")
{Label1->Caption="0";}
else {Label1->Caption=Label1->Caption+"0";
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button12Click(TObject *Sender)
{
a=StrToFloat(Label1->Caption);
Label1->Caption="0";
c=1;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button13Click(TObject *Sender)
{
a=StrToFloat(Label1->Caption);
Label1->Caption="0";
c=2;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button14Click(TObject *Sender)
{
a=StrToFloat(Label1->Caption);
Label1->Caption="0";
c=3;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button15Click(TObject *Sender)
{
a=StrToFloat(Label1->Caption);
Label1->Caption="0";
c=4;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button11Click(TObject *Sender)
{
b=StrToFloat(Label1->Caption);
if(c==1)
{
Label1->Caption=a+b;
}
if(c==2)
{
Label1->Caption=a-b;
}
if(c==3)
{
Label1->Caption=a*b;
}
if (c==4)
{
Label1->Caption=a/b;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button17Click(TObject *Sender)
{
Label1->Caption=FloatToStr(sqrt(StrToFloat(Label1->Caption)));
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button18Click(TObject *Sender)
{
Label1->Caption=FloatToStr(StrToFloat(Label1->Caption)*StrToFloat(Label1->Caption));
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button19Click(TObject *Sender)
{
Label1->Caption="0";
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button16Click(TObject *Sender)
{
Label1->Caption=FloatToStr(StrToFloat(Label1->Caption)/100*a);
Do'stlaringiz bilan baham: |