输入三个数由小到大输出 用指针实现 (帮帮我看看 我的程序哪出问题了)
#include"stdio.h"int main()
{
int pai(int *a,int *b,int *c);
int n1,n2,n3;
int *a,*b,*c;
printf("please input three number:\n");
scanf("%d,%d,%d",&n1,&n2,&n3);
a=&n1;
b=&n2;
c=&n3;
pai(*a,*b,*c);
}
int pai(int *a,int *b,int *c)
{
int team;
if(*a>*b)
{
team=*a;
*a=*b;
*b=team;
}
if (*a>*c)
{
team=*a;
*a=*c;
*c=team;
}
if(*b>*c)
{
team=*b;
*b=*c;
*c=team;
}
printf("%d,%d,%d",*a,*b,*c);
}
[ 本帖最后由 甁瓶里D罐罐 于 2010-5-17 19:39 编辑 ]