// demonstrates string comparison // mikhail nesterenko // 03/07/99 #include #include using std::cout; using std::endl; using std::cin; using std::string; int main(){ string quit; // quit after this comparison? do{ // entering first string cout << "Enter string 1 and hit Enter: "; string s1; cin >> s1; // entering second string cout << "Enter string 2 and hit Enter: "; string s2; cin >> s2;; // comparing strings entered if (s1 < s2) cout << "\"" << s1 << "\" < \"" << s2 <<"\""<< endl; else if (s1 > s2) cout << "\"" << s1 << "\" > \"" << s2 <<"\""<< endl; else cout << "\"" << s1 << "\" == \"" << s2 <<"\""<< endl; cout << "done? "; cin >> quit; }while(quit != "y"); }