container-string-比较

2019-08-29  本文已影响0人  人不知QAQ

#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;

}

上一篇 下一篇

猜你喜欢

热点阅读