comparing strings

Is there a way to check wether two variables have the same charecters with out useing strcmp?

1
2
3
4
std::string a = "Hello";
std::string b = "Hello";

if (a == b) cout << "They are the same";
Last edited on
You can use object oriented approach, like Stewbond suggested, or you can do the comparison your self by taking the different between each 2 characters. char can be treated like integers and you can take the difference between 2 letters. That's what strcmp does actually.
Last edited on
Topic archived. No new replies allowed.