hdoj2000

#include <iostream>
using namespace std;
int main() {
    char a,b,c,t1,t2,t3;
    while(cin>>a>>b>>c)
    {
        if(c<min(a,b)) t1=c;
        else
            {
                t1=min(a,b);
                if(a>b) t2=a;
                else t2=b;
            }
        if(c>max(a,b)) t3=c;
        else
            {
                t3=max(a,b);
                if(a>b) t2=b;
                else t2=a;
            }
        if(c<max(a,b)&&c>min(a,b)) t2=c;
        cout<<t1<<" "<<t2<<" "<<t3<<endl;
    }
    return 0;
}

max 和min函数的使用

写得很一般吧,再想想更短的代码吧

posted @ 2012-11-06 18:54  茉莉花茶  阅读(248)  评论(0)    收藏  举报