/* teststring5.cpp CIS 150 David Klick 6/30/05 Using some common string class functions/methods. */ #include #include using std::cout; using std::cin; using std::string; int main(void) { int i; string s1, s2, s3; // get two names from user cout << "Enter a name: "; cin >> s1; cout << "Enter another name: "; cin >> s2; // display what was read in cout << "You entered: " << s1 << ", " << s2 << '\n'; // compare the names if (s1 > s2) cout << s1 << " is greater than " << s2 << '\n'; else if (s1 < s2) cout << s1 << " is less than " << s2 << '\n'; else cout << "You entered the same name twice\n"; // display the lengths cout << "Length of first string is " << s1.length() << '\n'; cout << "Length of second string is " << s2.size() << '\n'; // display each character of s2 for (i=0; i