That code has a lot of things right.
Just needs a bit of fixing here and there.
Line 12: missing semicolon.
Line 16. Don't try to call the function in the cout statement. Instead just call the function first, on a line by itself. Then use cout to output the values of max and min.
Lines 24 and 25. The mere presence of a variable of type
double
is enough to raise a few eyebrows. Also, the two variables declared have the same name as the two parameters
max
and
min
in the function header, and hence hide them.
Try this instead:
24 25
|
*max = a[0];
*min = a[0];
|
Lastly, the function
determainHighestAndLowest()
is declared as returning a value of type
char
, but it doesn't return anything. In fact it doesn't need to return anything. Just declare the function as type
void
.
Personally, I would have passed the variables max and min
by reference rather than by pointer, since this is a C++ program.
See
Arguments passed by value and by reference in the function tutorial:
http://www.cplusplus.com/doc/tutorial/functions/
You might also just use a single for loop inside the function body, there's no need to have two separate loops.