Hello
I have a array with 4 numbers, I can't figure out how I can find and print the maximum number in the array. What is the best way of doing this?
Hello
I have a array with 4 numbers, I can't figure out how I can find and print the maximum number in the array. What is the best way of doing this?
What have you tried?
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
I can't figure it out
Really?
Consider this list of four integers by systematically reading them from one direction, e.g., left to right:
2 4 6 2
What is the maximum number? How did you know it was the maximum?
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
This sounds like homework, so make sure you understand it.Code:for(i=0; i<4; i++){ if(array[i]>maxvalue) maxvalue = array[i];
osxd00d, read our homework policy.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Thanks, now that I see it it looks so simple