#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 forecast; //constructor weather(int d, int hi, int lo, const string& name, const string& f): todaysDate {d}, tempHi {hi}, tempLo {lo}, day {name}, forecast {f} { } 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 " << forecast << "\n"; } struct stats { int tempHi; //Fahrenheit int tempLo; string forecast; }; 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() { for (int i {0}; i < n; ++i) { const weather w {i, a[i].tempHi, a[i].tempLo, weekday[i % weekSize], a[i].forecast}; w.print(); } return EXIT_SUCCESS; }