Could someone help me solve this. Not sure why it wont keeps freaking out on me. I think my compiler is broken or I am totally missing something because it keeps stopping at the end! I'm new to all this!
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
for (int i = 0; i<12; i++)
{
cout << "Enter total rainfall for month " << month[i] << ": ";
cin >> months[i].totalRainfall;
cout << "Enter high temperature: ";
cin >> months[i].highTemp;
while (months[i].highTemp < -100 || months[i].highTemp > 140)
{
cout << "ERROR: Temperature must be in the range of "
<< "-100 through 140.\n";
cout << "\tHigh Temperature: ";
cin >> months[i].highTemp;
}
cout << "Enter low temperature: ";
cin >> months[i].lowTemp;
while (months[i].lowTemp < -100 || months[i].lowTemp > 140)
{
cout << "ERROR: Temperature must be in the range of "
<< "-100 through 40.\n";
cout << "\tLow Temperature: ";
cin >> months[i].lowTemp;
}
}
//Calculate the monthly average temperature and total rainfall.
for (int i = 0; i<12; i++)
{
total = total + months[i].totalRainfall;
months[i].avgTemp= (months[i].highTemp + months[i].lowTemp)/2;
}
Cheggs to the rescue
http://www.chegg.com/homework-help/questions-and-answers/need-help-write-program-uses-structure-store-following-weather-data-particular-month-total-q20128495