#include #include //for the iomanipulator setw (stands for "set width") #include using namespace std; //A "range for loop" gives you access to all the values in one array, //but only in the order in which they are stored in the array. //It gives you no access to the subscript of each value. // //The variable monthLength is automatically of data type int, //because a is an array of ints. int main() { int a[] { 31, // 0 January 28, // 1 February 31, // 2 March 30, // 3 April 31, // 4 May 30, // 5 June 31, // 6 July 31, // 7 August 30, // 8 September 31, // 9 October 30, //10 November 31 //11 December }; int n {size(a)}; //number of elements in the array for (int i {0}; i < n; ++i) { cout << setw(2) << i << " " << a[i] << "\n"; } cout << "\n"; //Skip a line between the loops. for (auto monthLength: a) { //This is a "range for loop". cout << monthLength << "\n"; } return EXIT_SUCCESS; }