qp.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
FTOC.PAS
  Example Contents Index                                    Back
 
PROGRAM FtoC;
 
{ FTOC.PAS : Converts temperatures }
 
USES
    Crt;
 
CONST
    factor = 32.0;
 
VAR
    degrees_fahr, degrees_cel, answer : Real;
 
FUNCTION ConvertToCel( degrees : Real ) : Real;
BEGIN
    ConvertToCel := ((degrees - factor) * 5.0) / 9.0;
END;
 
BEGIN
 
    ClrScr;
    Writeln( 'Temperature Converter' );
    Writeln( 'Fahrenheit to Celsius' );
    Writeln;
    Write( 'Temperature in degrees Fahrenheit? ' );
    Readln( degrees_fahr );
    degrees_cel := ConvertToCel( degrees_fahr );
    Writeln( 'Equals ', degrees_cel:4:1, ' degrees Celsius' );
    Writeln;
 
END.