// Author: Keith Shomper // Date: 9/17/03 // Putpose: To demonstrate the string member functions size(), find(), and substr() #include #include using namespace std; int main() { string statement = "The quick brown fox jumped over the lazy dog"; string letter; string str; int pos; char c; cout << "The length of statement: " << endl; cout << "\t\"" << statement << "\" is " << statement.size() << endl << endl; cout << "Please provide a single letter: "; cin >> c; letter = c; getline(cin, str, '\n'); pos = statement.find(letter, 0); cout << "\nThe letter '" << letter << "' is found at position " << pos << endl; cout << "The string of length five at that position is \""; cout << statement.substr(pos, 5) << "\"" << endl; cout << "\nPlease enter a string: "; getline(cin, str, '\n'); cout << "The string you entered is: " << str << endl; return 0; }