杭电oj —— 2000

/*
输入三个字符后,按各字符的ASCII码从小到大的顺序输出这三个字符
*/
#include<cstdio>
int main(){
	char a,b,c;
	char temp;
	while(scanf("%c%c%c",&a,&b,&c) != EOF){
		//吸收输入的换行符 
		getchar();
		if(a > b) {
			temp = a;
			a = b;
			b = temp;
		}
		if(a > c) {
			temp = a;
			a = c;
			c = temp;
		}			
		//经过以上两步之后,a已经成为了最小的 
		if(b > c) {
			temp = b;
			b = c;
			c = temp;
		}

		printf("%c %c %c\n",a,b,c);

	}	
	return 0;
} 

 

猜你喜欢

转载自blog.csdn.net/LiLi_code/article/details/87442351