/* * arrayString.cpp (sklar/05-apr-2009) * * this program demonstrates using arrays of strings. * */ #include #include using namespace std; /* * declare global variable */ const int MAX = 5; // declare size of array as a constant /* * declare and define the printArray() function to display the * elements of the array that is passed as an argument to the function */ void printArray( string myArray[], int numArray ) { for ( int i=0; i> myArray[i]; cout << "please enter a sentence: "; getline( cin, myArray[i] ); } // end for i } // end of initArray() /** * define main() function */ int main() { string myArray[MAX]; initArray( myArray, MAX ); printArray( myArray, MAX ); } // end of main()