输入一个三位数,然后由小到大输出

来源:互联网 发布:成都办公软件机构 编辑:程序博客网 时间:2024/06/04 17:48
#include<stdio.h>void swap(int *q1,int *q2){     int term;     if(*q1>*q2)        {            term=*q1;            *q1=*q2;            *q2=term;     }}void excharge(int *p1,int *p2,int *p3){    swap(p1,p2);    swap(p1,p3);    swap(p2,p3);}int main(){    int a,b,c;    int *p1,*p2,*p3;    scanf("%d%d%d",&a,&b,&c);    p1=&a;    p2=&b;    p3=&c;    excharge(p1,p2,p3);    printf("%d %d %d\n",a,b,c);    return 0;}

这里写图片描述

原创粉丝点击