////////////////////////////////////////////////////////////////////// // // strings.cpp // // Started by Jeff Ondich on 4/1/98 // Last modified 4/1/98 // // This program demonstrates your textbook author's "string" // variable type. // // 1. Compile this like so: // // g++ -Wall -o strings strings.cpp -lg++ -lastra // // The "-lastra" combined with the "#include // lets you use Astrachan's variable types. // // 2. What's the \" about? // // 3. 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 something, 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 ); }