I wants to input a list of day temperatures and count the number of days with
temperatures above 20 degrees. The C++ program below is supposed to do this and display the result. A temperature of -100 indicates the end of the data.
using namespace std;
int main( )
nrAbove = 0;
cout << "Temperature of first day (-100 for end of input): ";
cin >> temp;
while (temp > -100)
if (temp > 20) // temperature above 20 degrees?
} // end of while loop
cout << "Number of days with temperature above 20 degrees C is ";
cout << nrAbove << endl;
Thanks for taking time to look at this.