Posted: Tue Dec 16, 2008 6:32 pm Post subject: My program won't run because of an error
Here's my program.
Turing:
procedure minmax(list: array1..*ofint,
var minimum, maximum :int, number :int)
minimum := list(1)
maximum := list(1) for i: 2..number
if list (i) > maximum then
maximum := list (i) elsif list (i) < minimum then
minimum := list (i) endif endfor end minmax
%The "agespan" program %Computes the difference between the largest and the smallest element in an array of ages type ageRange :1..120 put"Enter the number of ages" var number :int get number
var age: array1..number of ageRange
%Read in array with number elements put"Enter ", number, " ages" for i: 1..number
get age(i) endfor
var largest, smallest: ageRange
minmax(age,smallest,largest,number) put"Age span in group is ", largest-smallest
When I run it, it says "argument is the wrong type"
Can anyone help me fix the problem?
Sponsor Sponsor
Tony
Posted: Tue Dec 16, 2008 6:48 pm Post subject: RE:My program won\'t run because of an error
minmax is expecting list: array 1..* of int
what is the type of age?