string 类型的两个变量怎么比较
string str1 ,str2;
...... // 通过方法得到str1,str2
strcmp(str1.c_str(),str2.c_str());
strcmp 函数所要求的参数为char* 类型,所以使用c_str函数转换一下。
string 类型的两个变量怎么比较
string str1 ,str2;
...... // 通过方法得到str1,str2
strcmp(str1.c_str(),str2.c_str());
strcmp 函数所要求的参数为char* 类型,所以使用c_str函数转换一下。