how to compare strings in c++ greater code example Example: compare string c++ int compare (const string& str) const;