0

I got the average to work, but how can I make this program first list
the high & low temps? Any help with this would be great.


int sum, count; sum=0; count=0;
do {
count++;
int number=readNumber();
sum=sum+number;
cout << "The average is " << sum/(double)count << endl;
} while (runLoop);

2
Contributors
1
Reply
2
Views
10 Years
Discussion Span
Last Post by vmanes
0

You must also have variables for high and low, initially set to values well out of range (ie, high = -999, low = +999)

As each value is read in, compare it to high and to low, updating the appropriate variable as needed.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.