可以的.string 使用非常方便
比如
std::string s1=“hello world”;
std::string s2=“hello boy”;
const char *cc1=“hello girl”;
const char *cc2=“hello dog”;
if (s1cc1) {…} //这是可以的
if (s1s2) {…}//这是可以的
if (cc1cc2) {…}//这是错误的
if(strcmp(cc1cc2)) {…}//这是可以的
C/C++字符串比较
最后发布:2020-12-04 01:29:18首次发布:2020-12-04 01:29:18