I have a question:
Let's say there are two
< > !=
string temp1, temp2;
cout << "Enter first word: ";
cout << "Enter second word: ";
cout << "First word: " << temp1 << endl << "Second word: " << temp2 << endl;
if (temp1 > temp2)
cout << "One" << endl;
if (temp1.compare(temp2) < 0)
cout << "Two" << endl;
.compare() returns an integer, which is a measure of the difference between the two strings.
0indicates that the two strings compare as equal.
operator== simply returns a boolean, indicating whether the strings are equal or not.
If you don't need the extra detail, you may as well just use