Talaba haqida ma’lumot; guruh: 640-23(AX) I. F. Sh: Ortiqmirzo Ziyoviddinov Javlonbek o’g’li jurnal raqami : 23




Download 2,25 Mb.
bet2/2
Sana24.05.2024
Hajmi2,25 Mb.
#252707
1   2
Bog'liq
ortiqmirzo

Unit1.Cpp kod qismi:
//---------------------------------------------------------------------------

#include


#include
#pragma hdrstop

#include "Unit2.h"


//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm2 *Form2;
double a=0, b=0, c=0;
int k=0;
//---------------------------------------------------------------------------
__fastcall TForm2::TForm2(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm2::Button2Click(TObject *Sender)
{
if(Edit1->Text=="0"){
Edit1->Text=((TButton*)Sender)->Caption;
}
else {
if(Edit1->Text.Length()<9)
Edit1->Text=Edit1->Text+((TButton*)Sender)->Caption;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm2::Button8Click(TObject *Sender)
{
Edit1->Text="0";
}
//---------------------------------------------------------------------------
void __fastcall TForm2::Button10Click(TObject *Sender)
{
if(Edit1->Text.Length()>0){
Edit1->Text=Edit1->Text.Delete(Edit1->Text.Length(),1);}
else {
Edit1->Text="0";
}
}
//---------------------------------------------------------------------------
void __fastcall TForm2::Button13Click(TObject *Sender)
{
k=1;
a=Edit1->Text.ToDouble();
Edit1->Text="0";
}
//---------------------------------------------------------------------------

void __fastcall TForm2::Button5Click(TObject *Sender)


{
k=2;
a=Edit1->Text.ToDouble();
Edit1->Text="0";
}
//---------------------------------------------------------------------------

void __fastcall TForm2::Button11Click(TObject *Sender)


{
k=3;
a=Edit1->Text.ToDouble();
Edit1->Text="0";
}
//---------------------------------------------------------------------------

void __fastcall TForm2::Button9Click(TObject *Sender)


{
k=4;
a=Edit1->Text.ToDouble();
Edit1->Text="0";
}
//---------------------------------------------------------------------------

void __fastcall TForm2::Button18Click(TObject *Sender)


{
b=Edit1->Text.ToDouble();
switch (k) {
case 1: c=a+b; break;
case 2: c=a-b; break;
case 3: c=a*b; break;
case 4:
if(b==0){ShowMessage("0 ga bolimaydi!");}
else {c=a/b;}
break;

default:
;


}
Edit1->Text=FloatToStr(c);
}
//---------------------------------------------------------------------------

void __fastcall TForm2::Button12Click(TObject *Sender)


{
a=Edit1->Text.ToDouble();
if(a>0 || a<0){
Edit1->Text=pow(a,2);
} else {
ShowMessage("XATO!");
}
}
//---------------------------------------------------------------------------

void __fastcall TForm2::Button19Click(TObject *Sender)


{
int t=Edit1->Text.Pos(".");
if(t<1){
Edit1->Text=Edit1->Text+".";
}
}
//--------------------------------------------------------------------------


Va nihoyat kalkuliyator tayyor.

Download 2,25 Mb.
1   2




Download 2,25 Mb.

Bosh sahifa
Aloqalar

    Bosh sahifa



Talaba haqida ma’lumot; guruh: 640-23(AX) I. F. Sh: Ortiqmirzo Ziyoviddinov Javlonbek o’g’li jurnal raqami : 23

Download 2,25 Mb.