|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
#include<stdio.h>
void main()
{
void exchange(int *q1, int *q2, int *q3);
int a, b, c, *p1, *p2, *p3;
scanf_s("%d,%d,%d", &a, &b, &c);
p1 = &a;
p2 = &b;
p3 = &c;
exchange(p1, p2, p3);
printf("%d,%d,%d\n", a, b, c);
}
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;
}
输入的8,7,6
显示结果8,-858993460,-858993460
我以为vc坏了,下载stdioa也是这样的结果,我的台式机没问题啊,程序比较出来是正确的
|
|