////////////////////////////////////////////////////////////////////// // // cppstrings.cpp // // Started by Jeff Ondich on 4/1/98 // Last modified 9/16/99 // // This program demonstrates the C++ "string" // variable type. // // 1. Note that to use the string type, you need to // #include . // // 2. Compile and run the program. // // 3. What's the \" about in the output statements? // // 4. What if you type a return or two between your first // and second words? What if you have punctuation // between them? // ////////////////////////////////////////////////////////////////////// #include #include int main( void ) { string thisWord, thatWord; cout << "Type a sentence, please: "; cin >> thisWord >> thatWord; cout << "The first word you typed was \"" << thisWord << "\"" << endl; cout << "The second was \"" << thatWord << "\"" << endl; cout << "\"" << thisWord << "\" is " << thisWord.length() << " characters long." << endl; return( 0 ); }