#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, 43.5}, {"February", 28, 41.1}, //assume non-leap {"March", 31, 44.6}, {"April", 30, 57.6}, {"May", 31, 62.7}, {"June", 30, 70.0}, {"July", 31, 79.0}, {"August", 31, 75.0}, {"September", 30, 69.4}, {"October", 31, 60.5}, {"November", 30, 46.7}, {"December", 31, 44.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." << setw(2) << " avg temp: " << fixed << setprecision(1) << a[i].temp << " degrees farenheight.\n"; } return EXIT_SUCCESS; }