CompConversion (C++)
Description
This example demonstrates the use of Comp conversion functions.
Code
void __fastcall TForm2::Button1Click(TObject *Sender)
{
	Comp CompValue;
	Currency CurrencyValue;
	try {
		CompValue = StrToInt64(Edit1->Text);
		CurrencyValue = CompToCurrency(CompValue);
		Edit2->Text = CurrToStr(CurrencyValue);
		}
	catch (...) {
		MessageDlg("Enter a signed integer with abs value <= 9 * 10**18", mtError,
			TMsgDlgButtons() << mbOK, 0);
	}
}
//---------------------------------------------------------------------------
void __fastcall TForm2::Button2Click(TObject *Sender)
{
	Comp CompValue;
	Double DoubleValue;
	try {
		CompValue = StrToInt64(Edit3->Text);
		DoubleValue = CompToDouble(CompValue);
		Edit4->Text = FloatToStr(DoubleValue);
		}
	catch (...) {
		MessageDlg("Enter a signed integer with abs value <= 9 * 10**18", mtError,
			TMsgDlgButtons() << mbOK, 0);
	}
}
Uses
- System.CompToCurrency ( fr | de | ja )
- System.CompToDouble ( fr | de | ja )