代码如下:
#include <stdio.h>
#include<string.h>
main()
{
char ch1[20],ch2[20],ch3[20],*p1,*p2,*p3,*t;
p1=ch1;p2=ch2;p3=ch3;
gets(ch1);
gets(p2);
gets(p3); //scanf("%s",p3);
printf("\n");
if(strcmp(p1,p2)>0)
{t=p1;p1=p2;p2=t; }
if(strcmp(p1,p3)>0)
{t=p1;p1=p3;p3=t; }
if(strcmp(p2,p3)>0)
{t=p2;p2=p3;p3=t; }
puts(p1);
puts(p2);
puts(p3); //printf("%s",p3);
}
结果如下:
adfef
123
ABC
123
ABC
adfef
请按任意键继续. . .