#include<stdio.h>
int main()
{void exchange(int * q1,int * q2,int *q3);
int a,b,c,* p1,* p2,* p3;
printf_s("please enter three numbers:");
scanf_s("%d,%d,%d",&a,&b,&c);
p1=&a;
p2=&b;
p3=&c;
exchange(p1,p2,p3);
printf_s("The order is:%d,%d,%d\n",&a,&b,&c);
return 0;
}
void exchange(int * q1,int * q2,int * q3)
{void swap(int * pt1,int * pt2);
if(* q1<* q2)swap(q1,q2);
if(* q1<* q3)swap(q1,q3);
if(* q2<* q3)swap(q2,q3);
}
void swap(int *pt1,int *pt2)
{int temp;
temp=* pt1;
* pt1=* pt2;
* pt2=temp;
}
以上程式結果是
please enter three numbers:5,7,9
The order is:14416608,14416596,14416584
請按任意鍵繼續. . .
請問怎么回事
uj5u.com熱心網友回復:
printf_s("The order is:%d,%d,%d\n",a,b,c);轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/29285.html
標籤:基礎類
上一篇:CB 10.1 berlin 版 能否在 winXP下運行?
下一篇:望大神求解
