Re: simple Mph to Mps conversion

Posted by webmaster Guido on March 16, 2003

In Reply to: I NEED SOMTHIN MORE SIMPLER posted by Mike on March 15, 2003

: program task2;

: {$APPTYPE CONSOLE}

: [and so on]

: Can you please help me without changing any of the commands I just starting to learn it so I need to keep it simple thanx

Just have a look at the answer I gave you on March 13 :-) it's only a couple of lines below in the Forum...
Anyway, I'll repeat it here, condensed to its most minimal form:

program Convert;
{$APPTYPE CONSOLE}
uses
  SysUtils;
const
  MilesToMetres = 1606.344;
var
  Mph,        // miles per hour
  Mps: real;  // metres per second
begin
  Write('Key in speed (mph): ') ;
  ReadLn(Mph);
  Mps := Mph * MilesToMetres / 3600;
  WriteLn('The speed in mps is ', Mps : 4 : 1);
  ReadLn;
end.
 

 


[ DelphiLand Discussion Forum ]
Compiling Console Applications
Learn Pascal with simple Delphi Console Applications