#include #include using namespace std; int main() { // an array is a set or a list of variables, // all of the same data type // an array has a declared length, and elements // are accessed using []s (index 0 to length-1) const int MAX_ELEMENTS = 100; int numbers[ MAX_ELEMENTS ]; // we access each element of an array using // a for loop (most of the time!) for ( int i = 0 ; i < MAX_ELEMENTS ; i++ ) { // process each element -- e.g. initialize: numbers[i] = 10 * i; } // display the elements of the array for ( int i = 0 ; i < MAX_ELEMENTS ; i++ ) { cout << numbers[i] << ' '; } cout << endl; // we can initialize values at declaration int grades[5] = { 8, 7, 7, 6, 4 }; string days[7] = { "Sun", "Mon", "Tues", "Wed", "Thurs", "Fri", "Sat" }; days[4] = "Thursday"; cout << "Today is " << days[4] << endl; // string month1, month2, month3, .... return 0; }