0
program in c++ to compare two strings and return 0 if the two strings are equal and -1 is strings are unequal
2 ответов
- 1
just do
#include <string>
short compare(const std::string &a, const std::string &b)
{
return (a == b) ? 0 : -1;
}
or
#include <string>
bool compare(const std::string &a, const std::string &b)
{
return (a == b);
}
or just
a == b
+ 7
Hint:
Use compare() method from the string class.