代码 #include <iostream> #include <algorithm> using namespace std; int main() { char a[3]; while(cin>>a) { sort(a, a+3); cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<endl; } return 0; } 注解 1、水题。 2、会调用库函数的sort方法对字符排序。 结果