我想找出为什么比较功能没有给我正确的结果?
据我所知,如果两个字符串相同,则应该返回0!
bool validatePassword(char id[], string password) {
// cannot be the same as the id string
if(password.compare(id) == 0) {
cout << "password can not be as same as id\n";
return false;
}
return true;
}
Run Code Online (Sandbox Code Playgroud)