zoukankan      html  css  js  c++  java
  • HDOJ2000-ASCII码排序

     Problem Description

    输入三个字符后,按各字符的ASCII码从小到大的顺序输出这三个字符。
     
    Input
    输入数据有多组,每组占一行,有三个字符组成,之间无空格。
     

    Output

    对于每组输入数据,输出一行,字符中间用一个空格分开。
     

     Sample Input

    qwe
    asd
    zxc
     

     Sample Output

    e q w
    a d s
    c x z

     代码实现:

     1 #include<stdio.h>
     2 void main()
     3 {
     4     char a,b,c,d;
     5     while(scanf("%c%c%c%c",&a,&b,&c,&d)!=EOF)
     6     {
     7         if(a>b)
     8         {
     9             d=a;a=b;b=d;
    10         }
    11         if(b>c)
    12         {
    13             d=b;b=c;c=d;
    14         }
    15         if(a>b)
    16         {
    17             d=a;a=b;b=d;
    18         }
    19 
    20         printf("%c %c %c
    ",a,b,c);
    21     }
    22 }

    开始没注意到要在scanf()里面再加一个变量控制显示格式。

    杭电复试群里有声音说今年320调剂,难过,我很热情又诚恳的嘛。

  • 相关阅读:
    poj 2942 Knights of the Round Table 双连通分量
    zoj 2588 Burning Bridges 桥
    desin pattern
    android
    ubuntu
    centos
    android布局
    gradle
    好站
    tomcat datasource
  • 原文地址:https://www.cnblogs.com/hhccdf/p/4331207.html
Copyright © 2011-2022 走看看