SysUtilsStrToInt (C++)

From RAD Studio Code Examples
Jump to: navigation, search

Description

This example uses two edit boxes and a button on a form. When you click the button, the code converts the values in the edit boxes to numbers, adds them, and displays a message indicating the sum.

Code

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  int i1, i2;
  i1 = StrToInt(Edit1->Text);
  i2 = StrToInt(Edit2->Text);
  ShowMessage(IntToStr(i1 + i2));
}

Uses