, ( ).
: Currency Exchange .
:
(/);
;
, 볺, .
4- : 1) ComboBox; 2) ListBox; 3) () RadioGroup; 4) StringGrid. 4 . .
: ComboBox, ListBox, StringGrid, RadioButton RadioGroup .
ճ :
-
1. :
2. Caption : Label3, Label7 Text : ComboBox1, Edit1 Edit2 Edit3. ֳ .
3. Caption Label1, Label2, Label4, Label5, Label6, RadioButton1 RadioButton2 , :
10 .
4. OnClick RadioButton1 RadioButton2 , Caption Label3 Label7 . RadioButton1 RadioButton2 :
void __fastcall TForm1::RadioButton1Click(TObject *Sender)
{
Label3->Caption="";
Label7->Caption=" ";
}
//-------------------------------------------------------------------
void __fastcall TForm1::RadioButton2Click(TObject *Sender)
{
Label3->Caption="";
Label7->Caption=" ";
}
5. . . :
6. ᒺ, Items ComboBox1 , . ,
USD
Euro
RusRuble
7. , Edit1 , Unit1.h :
const double Kv[4][2]={5.05,5.15,6.1,6.2,0.15,0.16};
(, ) , ComboBox1. Edit1 , ComboBox1 . 䳿 OnChange ComboBox1 :
|
|
void __fastcall TForm1::ComboBox1Change(TObject *Sender)
{
if (RadioButton1->Checked)
Edit1->Text=FloatToStr(Kv[ComboBox1->ItemIndex][0]);
else
Edit1->Text=FloatToStr(Kv[ComboBox1->ItemIndex][1]);
}
Checked RadioButton. ItemIndex - ( ). , 1. FloatToStr .
ComboBox1.
8. (Edit3) (Edit2). OnChange Edit2:
void __fastcall TForm1::Edit2Change(TObject *Sender)
{
if (RadioButton1->Checked)
Edit3->Text=FloatToStr(StrToInt(Edit2->Text)*
Kv[ComboBox1->ItemIndex][0]);
else
Edit3->Text=FloatToStr(StrToInt(Edit2->Text)*
Kv[ComboBox1->ItemIndex][1]);
}
C++ Builder. exe- Widows.