<pre name= "code" class= "CPP" >/* descriptive narrative input three characters (capable of repeating) after. These three characters are output in the order of each character's ASCII code from small to large. Enter the first line to enter a number n, indicating that there are n sets of test data.The next n rows enter multiple sets of data, each of which is a single row and consists of three characters. No spaces between them.
Output for each set of input data, output one line. The middle of the character is separated by a space. Example input 3QWEASDZXC example output e q WA d SC x z*/
Example output
e q wa d SC x z
#include <stdio.h> #include <stdlib.h>int main () {char a,b,c,d; int i; scanf ("%d", &i); GetChar (); while (i--) { scanf ("%c%c%c", &a,&b,&c); GetChar (); if (a>b) { d=a; a=b; B=d; } if (a>c) { d=a; A=c; C=d; } if (b>c) { d=b; B=c; C=d; } printf ("%c%c%c", a,b,c); }}
ASCII-code Ordering