64,644
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
#include <cstdlib>
#include <string>
using namespace std;
int main(){
string s1("this"), s2("that");
if("that" == s2){
cout << "match" << endl;
}else{
cout << "not match" << endl;
}
if("this" == s1){
cout << "match" << endl;
}else{
cout << "not match" << endl;
}
if(s1 == s1.c_str()){
cout << "match" << endl;
}else{
cout << "not match" << endl;
}
if("this" == s1.c_str()){
cout << "match" << endl;
}else{
cout << "not match" << endl;
}
system("pause");
return 0;
}