输入三个正整数,从大到小排序

来源:互联网 发布:淘宝直播镜像 编辑:程序博客网 时间:2024/06/10 13:14
#include<stdio.h>void exchange(int *q1,int *q2,int *q3);void  swap(int *t1,int *t2){    if(*t1<*t2)    {        int temp;        temp=*t1;        *t1=*t2;        *t2=temp;    }}int   main(){    int  a,b,c,*p1,*p2,*p3;    scanf("%d%d%d\n",&a,&b,&c);    p1=&a;     p2=&b;    p3=&c;    exchange(p1,p2,p3);    printf("%d %d %d",a,b,c);    return 0;}void exchange(int *q1,int *q2,int *q3){    swap(q1,q2);    swap(q1,q3);    swap(q2,q3);}

图片:这里写图片描述

原创粉丝点击