输入3个整数,按从小到大的顺序输出

#include
#include
void main()
{
char *p1, *p2, *p3;
char a[100], b[100], c[100];
char temp;
gets(a);
gets(b);
gets©;
p1 = &a; p2 = &b; p3 = &c;
if (a > b)
{
temp = *p1;
*p1 = *p2;
*p2 = temp;
}
if (a > c)
{
temp = *p1;
*p1 = *p3;
*p3 = temp;
}
if (b > c)
{
temp = *p2;
*p2 = *p3;
*p3 = temp;
}
printf("%s,%s,%s ", *p1, *p2, *p3);
}

你可能感兴趣的:(输入3个整数,按从小到大的顺序输出)