This method is quick and clean, basically read in values the number of times specified, and each time the number is greater than the current maximum, replace max with the value read.
int main()
{
int num_entries;
float num;
float max = 0;
cin >> num_entries;
while (num_entries-- > 0){
cin >> num;
if (num > max) {
max = num;
}
}
}
3
solved How to print largest number from User Input