string compare c++ example programs Example: compare string c++ int compare (const string& str) const;