ASCII码排序
2018-12-07 本文已影响0人
bbmessi


#include<iostream>
using namespace std;
int main()
{
char s[3];
while (cin >> s)
{
for (int i = 0; i < 3; i++)
{
for (int j = i + 1; j < 3; j++)
{
if (s[j] < s[i])
{
int temp = s[i];
s[i] = s[j];
s[j] = temp;
}
}
}
cout << s[0];
for (int i = 1; i < 3; i++)
{
cout << " " << s[i];
}
cout << endl;
}
return 0;
}