//2.Enter three strings, in order from small to large outputint selectThreeStrings(){ void changeString(string &st1, string &st2); string str1, str2, str3;// char *p1 = &str1[0], *p2 = &str2[0], *p3 = &str3[0]; cout << "input three strings:" << endl; cin >> str1; cin >> str2; cin >> str3; if (str1 > str2)changeString(str1, str2); if (str1 > str3)changeString(str1, str3); if (str2 > str3)changeString(str2, str3); cout << endl << "Now the order is:" << endl; cout << str1 << endl << str2 << endl << str3 << endl; return 0;}
#include <string>
就可以了。
不上述的头文件的话,需要把string换成char*;
就可以了。
不上述的头文件的话,需要把string换成char*;
温馨提示:答案为网友推荐,仅供参考