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.
SUMREAL.PAS
  Example Contents Index                                    Back
 
PROGRAM sumreal;
 
{ SUMREAL.PAS returns the sum of its real parameters. It illustrates
  the following routines:
 
      ParamCount    ParamStr    Val
}
 
CONST
    program_name = 'SUMREAL ';
    program_desc = ' prints the sum of its real parameters.';
 
VAR
    count    : Word;
    real_num : Real;
    sum      : Real;
    status   : Integer;
 
BEGIN
 
    Writeln( program_name, program_desc );
    Writeln;
 
{$R-}
    sum := 0;
    FOR count := 1 TO ParamCount DO
        BEGIN
        Val( ParamStr( count ), real_num, status );
        IF (status <> 0) THEN
            Writeln( 'Real parameter ', count, ' out of range.' )
        ELSE sum := sum + real_num;
        END;
{$R+}
    Writeln( 'The sum of the valid parameters is ', sum:1:11 );
 
END.