|
//---------------------------------------------------------------------------
|
bet | 6/6 | Sana | 31.12.2021 | Hajmi | 367,72 Kb. | | #228213 |
| Bog'liq 5-Laboratoriya Algaritimni loyihalash
//---------------------------------------------------------------------------
void __fastcall TKalkulyator::t6Click(TObject *Sender)
{if (win)
ekran->Clear();
ekran->Text =ekran->Text + "6";
win = 0;
}
//---------------------------------------------------------------------------
void __fastcall TKalkulyator::t7Click(TObject *Sender)
{if (win)
ekran->Clear();
ekran->Text =ekran->Text + "7";
win = 0;}
//---------------------------------------------------------------------------
void __fastcall TKalkulyator::t8Click(TObject *Sender)
{if (win)
ekran->Clear();
ekran->Text =ekran->Text + "8";
win = 0;}
//---------------------------------------------------------------------------
void __fastcall TKalkulyator::t9Click(TObject *Sender)
{if (win)
ekran->Clear();
ekran->Text =ekran->Text + "9";
win = 0;}
//---------------------------------------------------------------------------
void __fastcall TKalkulyator::kopClick(TObject *Sender)
{ win = 1;
if (p) {
b = StrToFloat(ekran->Text);
}i = '*';
}
//---------------------------------------------------------------------------
void __fastcall TKalkulyator::t0Click(TObject *Sender)
{ win = 0;
if (ekran->Text == "0" && ekran->Text == "")
ekran->Text = "0";
else
ekran->Text = ekran->Text + "0";
}
//---------------------------------------------------------------------------
void __fastcall TKalkulyator::clearClick(TObject *Sender)
{
p = 1;
ekran->Clear();
b = 0;
a = 0;
}
//---------------------------------------------------------------------------
void __fastcall TKalkulyator::ishoraClick(TObject *Sender)
{ if (z) {
ekran->Text = "-" + ekran->Text;
} else {
ekran->Text=ekran->Text.Delete(1,1);
}
z = !z;
}
//---------------------------------------------------------------------------
void __fastcall TKalkulyator::BitBtn1Click(TObject *Sender)
{
ekran->Text=ekran->Text.Delete(ekran->Text.Length(),1);
}
//---------------------------------------------------------------------------
void __fastcall TKalkulyator::Button1Click(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
void __fastcall TKalkulyator::bolClick(TObject *Sender)
{ win = 1;
if (p) {
b = StrToFloat(ekran->Text);}
i = '/';
}
//---------------------------------------------------------------------------
void __fastcall TKalkulyator::minusClick(TObject *Sender)
{ win = 1;
if (p) {
b = StrToFloat(ekran->Text);
}i = '-';
}
//---------------------------------------------------------------------------
void __fastcall TKalkulyator::plusClick(TObject *Sender)
{
if (p) {
b = StrToFloat(ekran->Text);
}win = 1;
i = '+';
}
//---------------------------------------------------------------------------
void __fastcall TKalkulyator::tengClick(TObject *Sender)
{ win = 1;
a = StrToFloat(ekran->Text);
switch (i) {
case '*': a = b*a; break;
case '/': a = b/a; break;
case '+': a = a+b; break;
case '-': a = b-a; break;
}
ekran->Text = FloatToStr(a);
b = a;
p = 0;
}
//---------------------------------------------------------------------------
void __fastcall TKalkulyator::foizClick(TObject *Sender)
{win = 1;
a = StrToFloat(ekran->Text);
a = a/100.;
ekran->Text = FloatToStr(a);
}
//---------------------------------------------------------------------------
Do'stlaringiz bilan baham: |
|
|