杭电2000 ( ASCII码排序 )

来源:互联网 发布:55e70rg能下网络电视吗 编辑:程序博客网 时间:2024/06/07 00:42
#include<iostream>using namespace std;void queue(char a[]){    while(cin>>a)    {        int b[3];        b[0]=a[0];        b[1]=a[1];        b[2]=a[2];        for(int i=0;i<3;i++)            for(int j=i+1;j<3;j++)            {                if(b[i]>b[j])                {                    char temp1=0;                    int temp2=0;                    temp1=a[i];                    a[i]=a[j];                    a[j]=temp1;                    temp2=b[i];                    b[i]=b[j];                    b[j]=temp2;                }            }        cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<endl;    }}int main(){    char a[3];    queue(a);    return 0;

}

0 0