A - ASCII code ordering

A - ASCII code ordering


Title Description

After three input characters in ASCII code for each character in the ascending order of the output of these three characters.

Input

Enter data multiple groups, each accounting for one line, there are three characters, with no spaces between.

Output

For each case, an output line, separated by a space character intermediate.

Sample Input

qwe
asd
zxc

Sample Output

e q w
a d s
c x z

The sample program:

#include <stdio.h>
int main(){
    char a,b,c,t;
    while(scanf("%c%c%c%*c",&a,&b,&c)!=EOF)     {
        if(a>b) t=a,a=b,b=t; 
        if(a>c) t=a,a=c,c=t;
        if(b>c) t=b,b=c,c=t;
        printf("%c %c %c\n",a,b,c);
    }
    return 0;
}

EOF is a computer terminology, abbreviations for the End Of File in the operating system information indicating the source of the information can be read no more. Data source commonly referred to as a file or stream. Usually in the presence of the final text of this character indicates the end of data.

EOF is a macro (macro concept of the future will come into contact with), if scanf returns EOF, explained that it had read the file (this is the stdin stream) at the end, and no data.

May be used while loop ends ctrl + z

Published 25 original articles · won praise 7 · views 1917

Guess you like

Origin blog.csdn.net/weixin_43426647/article/details/84678303