ASCII-code Ordering

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.