C++primer 6.18
比较string大小,其实很简单,练手吧,快改找工作了,谁跟我提点建议啊?谢谢啦
只看了C++,据说还要考察操作系统神马的:
不说了,把代码贴上吧:
#include <iostream> #include<string> using namespace std; int main() { string s1,s2; bool flag = true; cout << "Please input two strings s1 and s2:" << endl; while (flag == true && cin>>s1>>s2 ) { cout << (s1<s2?s1:s2) << " is small"<<endl << "if you want to continue comparing ,please input 1,else 0"<<endl; cin >> flag; } }