问题描述
- 按各字符的ASCII码从小到大的顺序输出这三个字符
-
输入三个字符后,按各字符的ASCII码从小到大的顺序输出这三个字符输入数据有多组,每组占一行,有三个字符组成,之间无空格。 对于每组输入数据,输出一行,字符中间用一个空格分开。 #include"iostream"
using namespace std;
int main(int argc, char* argv[])
{
char a,b,c;
while((cin>>a>>b>>c))
{
if(a<b&&b<c)
cout<<a<<" "<<b<<" "<<c<<" "<<endl;
if(b<a&&a<c)
cout<<b<<" "<<a<<" "<<c<<" "<<endl;
if(a<c&&c<b)
cout<<a<<" "<<c<<" "<<b<<" "<<endl;
if(b<c&&c<a)
cout<<b<<" "<<c<<" "<<a<<" "<<endl;
if(c<a&&a<b)
cout<<c<<" "<<a<<" "<<b<<" "<<endl;
if(c<b&&b<a)
cout<<c<<" "<<b<<" "<<a<<" "<<endl;
}
return 0;
}不明白哪错了,ACM上提交不上
时间: 2024-11-03 14:52:53