C++中判断两个字符串是否相等,怎么判断

如题所述

#include<iostream>
#include<string>
using namespace std;
int main()
{
    string s1="123456789";
    string s2="987654321";
    if(s1==s2)
    {
        cout<<s1<<'='<<s2<<endl;
    }
    else
    {
        cout<<s1<<"!="<<s2<<endl;
    }
    system("pause");
    return 0;
}

温馨提示:答案为网友推荐,仅供参考