SystemInt (Delphi)

From RAD Studio XE2 Code Examples
Jump to: navigation, search

Language:

Description

Click the button to display the integer part of any positive or negative real number.

Code

procedure TForm1.Button1Click(Sender: TObject);
var 
  R: Real;
begin
  R := StrToFloat(Edit1.Text);     { 123.456 }
  R := Int(R);                     { 123.0 }
  Edit2.Text := FloatToStr(R);
end;

Uses

Personal tools
Previous Versions