求助:如此结果是咋回事?
昵称是咩呀 2012-05-29 02:30:06 1 #include <iostream>
2 #include <string>
3 using namespace std;
4
5 int main()
6 {
7 string s1,s2;
8 cout << "Enter two strings:" << endl;
9 cin >> s1 >> s2;
10 if(s1==s2)
11 cout << "They are equal!" << endl;
12 else if(s1>s2)
13 cout << "\"" << s1 << "\"is biger than" << "\"" << s2 << "\""
<< endl;
14 else if(s1<s2)
15 cout << "\"" << s2 << "\"is biger than" << "\"" << s1 << "\""
<< endl;
16 }
程序如上,执行的时候:
提示:“Enter two strings:”
输入:“vgcfcfxdzs hghgc”(随机输入)
结果:"vgcfcfxdzs"is biger than"hghgc"---正常
再执行:
提示:“Enter two strings:”
输入:“zsxdcfvgb bhyujhgfvcdxscg”
结果:"zsxdcfvgb"is biger than"bhyujhgfvcdxscg"---反常
不知道怎么回事,求指教,谢谢!!!