#include #include #include #include using namespace std; int main() { // Create a new data type, named "month". struct month { string name; int length; double temperature; // 2023 New York City average temperature in Fahrenheit }; // Create an array of 12 months with temperatures. month a[] { {"January", 31, 43.5}, {"February", 28, 41.1}, // Assume non-leap year {"March", 31, 48.4}, {"April", 30, 56.3}, {"May", 31, 63.8}, {"June", 30, 72.2}, {"July", 31, 79.6}, {"August", 31, 78.4}, {"September", 30, 72.9}, {"October", 31, 62.4}, {"November", 30, 51.8}, {"December", 31, 43.6} }; // Loop through the array with a plain old for loop. int n {size(a)}; // the number of elements in the array for (int i {0}; i < n; ++i) { cout << left << setw(10) << a[i].name << " (month number " << right << setw(2) << i + 1 << ") has " << a[i].length << " days and an average temperature of " << fixed << setprecision(1) << a[i].temperature << "°F.\n"; } return EXIT_SUCCESS; }