alright so you guys seemed like the people to ask.
my teacher asked me to basically do this:
take a bunch of numbers and find the highest, i have to use a while loop to get all the numbers. I have no clue how that would look in code and my book is a piece of ........ so it doesn't help.
the actual promt is : a teacher has a set of student grades and wants to know the highest grade in the class regardless of the number of students in the class. develope a program to accomplish this
a pseudocode or agorethm is helpful
Welcome to the forum, katherene
(Next time, click New Thread to start a new topic.)
It depends on how the grades are given to you. They will probably be given in an array, or from a disk file.
The general idea is to initialize Max (and Min) to the first value.
Assuming the grades are stored in an array, the first grade in the list is Grade.
Then you go into a loop and compare the next grade to the Max & Min, updating if necessary...
Max = Grade; // Initialize Max and Min before entering the loop.
Min = Grade; // Max and Min are the same until you check the next grade in the list
When you do this in your loop, the array index will be a variable. Something like this:
if( Grade > Max) // Update Max if needed
Max = Grade;
if( Grade < Min) // Update Min if needed
Min = Grade;