用指针的方法
输入3个数 按照从小到大的顺序输出
main()
{
int a,b,c;
int *p1,*p2,*p3;
int *t;
printf("\nPlease input three integers:\n");
scanf("%d,%d,%d",&a,&b,&c);
p1=&a,p2=&b,p3=&c;
if(p1>p2)
t=p1,p1=p2,p2=t;
if(*p1>*p3)
t=p1,p1=p3,p3=t;
if(*p2>*p3)
t=p2,p2=p3,p3=t;
printf("new ordr:\n");
printf("%d,%d,%d",*p1,*p2,*p3);
}
阅读(956) | 评论(2) | 转发(0) |