/*! Title: After describing the input three characters (which can be duplicated), the ASCII code of each character is printed in the order of three characters 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 with a row of three characters and no spaces between them. Output for each set of input data, output one line, the middle of the character separated by a space. Sample input 2QWEASD sample output e q WA d s*/#include"stdio.h"#include"stdlib.h"using namespacestd;voidMain () {intnum; scanf_s ("%d", &num); intindex =0; Char*arr = (Char*)malloc(sizeof(Char) *3*num); GetChar (); for(inti =0; i < num; i++) { for(intj =0; J <3; J + +) {Arr[i*3+J] =GetChar (); } getchar (); } for(inti =0; i < num; i++) { CharA = Arr[i *3]; Charb = arr[i *3+1]; Charc = arr[i *3+2]; if(A >b) {inttemp =A; A=b; b=temp; } if(A >c) {inttemp =A; A=C; C=temp; } if(B >c) {inttemp =b; b=C; C=temp; } printf ("%c", a); printf ("%c", B); printf ("%c\n", c); } Free(arr); Arr=NULL; System ("Pause");}
"ACM" ASCII code ordering