/* * string0.cpp (sklar/05-apr-2009) * * this program demonstrates using a global array in a function. * */ #include #include using namespace std; /* * declare global variable */ string myString; /* * declare and define the printString() function to display the string */ void printString() { cout << "your string = [" << myString << "]" << endl; } // end printString() /** * define main() function */ int main() { // initialize string cout << "enter a string: "; getline( cin, myString ); // now call function to print the string printString(); } // end of main()