可以的.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++字符串比较
最新推荐文章于 2023-12-17 19:14:51 发布