"ACM" ASCII code ordering

Source: Internet
Author: User

/*! 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

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.