How to you get scar to convert an integer into a decimal. like if X := 50. How do you make X := 0.05
How to you get scar to convert an integer into a decimal. like if X := 50. How do you make X := 0.05
SCAR Code:program New;
var I: Integer;
E: Extended;
begin
I := 50;
E := StrToFloat(IntToStr(I));
end.
Last edited by Frement; 05-16-2010 at 07:16 PM.
There used to be something meaningful here.
SCAR Code:var
x: Extended;
i: Integer;
begin
i := 5;
x := i + 0.0;
Writeln('x: '+ToStr(x));
end.
Hope that helps.
Frement! Bad practice to do some many conversions. :<
And you never use S.
Those Both Don't work? Well Frements works but it only displays 50.
You have to run mine on Simba.Sorry.
Basically, you just need to add 0.0 to an integer to make it extended.
Also, for your specific example..
SCAR Code:var
ext: Extended;
int: Integer;
begin
int := 50;
ext := int * 0.001;
Writeln(ext);
end.
SCAR Code:Successfully compiled (102 ms)
0.05
Successfully executed
There are currently 1 users browsing this thread. (0 members and 1 guests)