美文网首页
container-string-比较

container-string-比较

作者: 人不知QAQ | 来源:发表于2019-08-29 15:53 被阅读0次

#include <iostream>

using namespace std;

#include <string>

void test01()

{

string  str1 = "hello";

string  str2 = "xello";

if (str1.compare(str2) == 0)

{

cout << "str1=str2" << endl;

}

else if (str1.compare(str2) >0)

{

cout << "str1<str2" << endl;

}

else

{

cout << "str1>str2" << endl;

}

}

int main()

{

test01();

system("pause");

return 0;

}

相关文章

网友评论

      本文标题:container-string-比较

      本文链接:https://www.haomeiwen.com/subject/triiectx.html