|
Guruh talabasi Bekmurodov Ro‘zivoy Valyuta konventori dasturi
|
tarix | 28.08.2023 | ölçüsü | 58,58 Kb. | | #140870 |
| 1-dedline dasturlash2
720-21 guruh talabasi Bekmurodov Ro‘zivoy
Valyuta konventori dasturi
Formaga yuklanadigan komponentalar:
Label 3 ta
Edit 2 ta
Buton 2 ta
Dastur interfeysi:
Dastur kodlari
Unit1.h faylining kodlari:
//---------------------------------------------------------------------------
#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include
#include
#include
#include
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TEdit *Edit1;
TEdit *Edit2;
TLabel *Label1;
TLabel *Label2;
TLabel *Label3;
TLabel *Label4;
TButton *Button1;
TButton *Button2;
void __fastcall Edit1KeyPress(TObject *Sender, char &Key);
void __fastcall Edit2KeyPress(TObject *Sender, char &Key);
void __fastcall Button1Click(TObject *Sender);
void __fastcall Button2Click(TObject *Sender);
private: // User declarations
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
Unit1.cpp faylining kodlari:
//---------------------------------------------------------------------------
#include
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Edit1KeyPress(TObject *Sender, char &Key)
{
/*if ((Key >= '0') && (Key <= '9'))
return;
if (Key == DecimalSeparator) {
if ((Edit1->Text).Pos(DecimalSeparator) != 0)
Key = 0;
return;
)
if (Key == VK_BACK)
return;
if (Key == VK_RETURN)
{
Edit2->SetFocus();
return;
}
Key = 0;*/
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Edit2KeyPress(TObject *Sender, char &Key)
{
/*if ((Key >= '0') && (Key <= '9'))
return;
if (Key == DecimalSeperator)
{
if ((Edit2->Text).Pos(DecimalSeperator) != 0)
Key = 0;
return;
}
if (Key == VK_BACK)
return;
if (Key == VKRETURN)
{
Button1->SetFocus();
return;
}
Key = 0;*/
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
float usd;
float k;
float som;
if (((Edit1->Text).Length() == 0) ||
((Edit2->Text).Length() == 0))
{
MessageDlg("Pichan va kursni olib kelish kerak", mtInformation, TMsgDlgButtons() << mbOK, 0);
if ((Edit1->Text).Length() == 0)
Edit1->SetFocus();
else
Edit2->SetFocus();
return;
}
usd = StrToFloat(Edit1->Text);
k = StrToFloat(Edit2->Text);
som = usd * k;
Label4->Caption=FloatToStrF(usd,ffGeneral,7,2)+"$ = "+FloatToStrF(som,ffGeneral,7,2)+" som.";
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
Form1->Close();
}
//---------------------------------------------------------------------------
Dastur natijasi:
Dostları ilə paylaş: |
|
|