0

Hi there I have been asked to design a program that asks the user to enter 12 months rainfall figures then carry out some simple calculations. i.e maximum rainfall,average,minimum etc etc
Arrays, parameter passing and procedures have to be used.

Firstly how do you make the program accept both real and integer values?
Also what is parameter passing and how can it be incorparated?
Is there a good site to find out these things cos this programming module is quite baffling!!!

2
Contributors
1
Reply
3
Views
9 Years
Discussion Span
Last Post by Duoas
0

Pascal is pretty smart about typecasting between real and integer.

var
  i: integer;
  r: real;
begin
  write( 'Enter an integer> ' ); readln( i );
  write( 'Enter a float> ' ); readln( r );
  writeln( 'You entered ', i, ' and ', r:5:2, '.' );
  writeln( 'The sum is ', (i + r):5:2 )
end.

A good tutorial: Pascal Programming.

A good reference: Free Pascal Reference Guide.

Hope this helps.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.