C++中判断两个字符串是否相等,怎么判断?
m = new CMd;
string text1="12345678";
m->TargetStr("abcd");
string text2=m->GetDigestKey(); //加密函数,加密后得到text2
string aa1=md5text1.substr(0,4);
string bb2=md5text2.substr(0,4);
if (xx2==aa1){ //只比较它们的前4位是否一致,如果一致就显示
cout<<" 相等"<<aa1<<endl;
}
错误提示: error C2678: binary '==' : no operator defined which takes a left-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' (or there is no acceptable conversion)