[実数型への変換]
それぞれの型を、実数型に変換します。
【ソースコード】 [tips0009.pas]
program tips0009;
{$APPTYPE CONSOLE}
uses SysUtils;
var
a:Integer;
b:TDateTime;
c:Boolean;
d:String;
e,f,g,h :Double;
begin
a:=10;
b:=now;
c:=True;
d:='-1.012';
e:=a;
f:=Double(b);
g:=Ord(c);
h:=StrToFloat(d);
WriteLn(FloatToStr(e));
WriteLn(DateTimeToStr(f));
WriteLn(FloatToStr(g));
WriteLn(FloatToStr(h));
end.
【コンパイル&実行】 [tips0009.bat]
dcc32 tips0009.pas
tips0009.exe > tips0009.txt
pause
【実行結果】 [tips0009.txt]
10
2009/05/23 22:48:49
1
-1.012
Copyright c 2009, ohishi,All rights reserved.