#include #include //for the i/o manipulator setw #include #include using namespace std; class weather { public: int todaysDate; int tempHi; int tempLo; string day; string weather; void print() const; }; const string weekday[] { "Tuesday", //0 "Wednesday", //1 "Thursday", //2 "Friday", //3 "Saturday", //4 "Sunday", //5 "Monday" //6 }; const size_t weekSize {size(weekday)}; void weather::print() const { cout << "Day " << todaysDate+1 << " " //Humans count starting at 1. << setw(10) << left << day + "," << " " << "High of " << setw(2) << tempHi << "F, " << "Low of " << setw(2) << tempLo << "F, " << "Forecast of " << weather << "\n"; } struct stats { int tempHi; //Fahrenheit int tempLo; string weather; }; const stats a[] { {74, 61, "Sunny"}, //0 {84, 67, "Sunny"}, //1 {90, 72, "Partly Cloudy"}, //2 {85, 68, "Partly Cloudy"}, //3 {75, 65, "Showers"}, //4 {79, 63, "Partly Cloudy"}, //5 {74, 63, "Partly Cloudy"}, //6 {74, 65, "Mostly Cloudy"} //7 }; const size_t n {size(a)}; int main() { weather w; for (int i {0}; i < n; ++i) { w.todaysDate = i; w.day = weekday[i % weekSize]; w.tempHi = a[i].tempHi; w.tempLo = a[i].tempLo; w.weather = a[i].weather; w.print(); } return EXIT_SUCCESS; }