#include #include using namespace std; int main() { int a[] { //An array of 12 ints. Square brackets are empty. 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 (no comma) }; //Could have created the entire array all on one line: //int a[] {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; //Here are the 12 variables we just created. //I wish we could output them with a loop. cout << a[0] << "\n"; //The value of a[0] is 31, for January. cout << a[1] << "\n"; //The value of a[1] is 28, for February. cout << a[2] << "\n"; //The value of a[2] is 31, for March. cout << a[3] << "\n"; //The value of a[3] is 30, for April. cout << a[4] << "\n"; //The value of a[4] is 31, for May. cout << a[5] << "\n"; //The value of a[5] is 30, for June. cout << a[6] << "\n"; //The value of a[6] is 31, for July. cout << a[7] << "\n"; //The value of a[7] is 31, for August. cout << a[8] << "\n"; //The value of a[9] is 30, for September. cout << a[9] << "\n"; //The value of a[10] is 31, for October. cout << a[10] << "\n"; //The value of a[11] is 30, for November. cout << a[11] << "\n"; //The value of a[12] is 31, for December. //Subscript out of bounds causes unpredictable behavior, //possibly crashing the program. Don't do this! //cout << a[12] << "\n"; //Subscript too big: there is no a[12]. //cout << a[-1] << "\n"; //Subscript too small: there is no a[-1]. return EXIT_SUCCESS; }