#include #include //for the i/o manipulators setw, left, right #include #include using namespace std; int main() { //Create a new data type, named "month". struct month { string name; int length; double temp; }; //Create an array of 12 const months: const month a[] { {"January", 31, 41.0}, {"February", 28, 43.4}, //assume non-leap {"March", 31, 47.1}, {"April", 30, 49.2}, {"May", 31, 67.7}, {"June", 30, 71.2}, {"July", 31, 83.8}, {"August", 31, 84.9}, {"September", 30, 77.1}, {"October", 31, 70.2}, {"November", 30, 63.1}, {"December", 31, 45.6} }; //Loop through the array with a plain old for loop. const size_t n {size(a)}; //the number of elements in the array for (int i {0}; i < n; ++i) { cout << left << setw(9) << a[i].name << " (month number " << right << setw(2) << i+1 << ") has " << setw(2) << a[i].length << " days with an average temperature of " << a[i].temp << ".\n"; } return EXIT_SUCCESS; }