ASCII-code ordering
Describe
After entering three characters (which can be repeated), the ASCII code of each character is printed in the order of three characters from small to large.
-
Input
-
The first line enters a number n, which indicates 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, the output line is separated by a space between the characters.
-
Sample input
-
3qweasdzxc
-
Sample output
-
e q wa d SC x z
#include<iostream>#include<string>using namespacestd;intMain () {Chararr[3]; Charch; inttest; CIN>>test; while(test--) { for(intI=0;i<3; i++) Cin>>Arr[i]; for(intI=0;i<3; i++){ for(intj=0;j<2-i;j++){ if(arr[j]>arr[j+1]) {ch=Arr[j]; ARR[J]= arr[j+1]; Arr[j+1] =ch; } } } for(intI=0;i<3; i++) {cout<<arr[i]<<" "; }} cout<<Endl; return 0; }
ASCII-code Ordering