如何用c语言编写从键盘输入3个数给a,b,c,然后依次交换他们中的数?

void main()
{
int a,b,c,d;
printf("exchange of three number\n")
scanf("%d%d%d,&a,&b,&c");
printf("Input number is:%d and d% and %d\n",a,b,c);
d=a;
a=b;
b=c;
c=d;
printf("exchange is:%d%d%d\n"a,b,c,);
getch();
}
这是我写的,但是编译不成功,请教各位大哥大姐帮帮我改改错误吧!

第1个回答  2008-10-12
多看几遍数组的排序(比如冒泡排序),指针的使用,这道题就能做出来了!最多花你两天的时间! 提示你一下吧,
int a,b,c; int *p1,*p2,*p3;
这道题主要考的其实是指针,你的那种编写太没技术含量了!
第2个回答  2008-10-12
void main()
{
int a,b,c,d,temp;
printf("exchange of three number\n")
scanf("%d%d%d",&a,&b,&c);
printf("Input number is:%d and d% and %d\n",a,b,c);
temp=d; \\用temp来过渡一下
d=a;
a=b;
b=c;
c=temp;
printf("exchange is:%d%d%d\n",a,b,c,); \\a前面有逗号别忘了
getch();
}
第3个回答  2008-10-12
更改后如下:
#include<stdio.h>
#inckude<conio.h>

void main()
{
int a,b,c,d;
printf("exchange of three number\n") ;
scanf("%d%d%d",&a,&b,&c);
printf("Input number is:%d and %d and %d\n",a,b,c);
d=a;
a=b;
b=c;
c=d;
printf("exchange is:%d%d%d\n",a,b,c);
getch();
}

参考资料:成功编译过

第4个回答  2008-10-12
void main()
{
int a,b,c,d;
printf("exchange of three number\n") ;
scanf("%d%d%d",&a,&b,&c);
printf("Input number is:%d, %d, %d\n",a, b, c);
d=a;
a=b;
b=c;
c=d;
printf("exchange is:%d %d %d \n",a,b,c);
getch();
}
哥们看看这个

参考资料:东北虎

第5个回答  2008-10-12
void main()
{
int a,b,c,d;
printf("exchange of three number\n")
scanf("%d%d%d",&a,&b,&c);
printf("Input number is:%d and d% and %d\n",a,b,c);
d=a;
a=b;
b=c;
c=d;
printf("exchange is:%d%d%d\n",a,b,c,);
getch();
}本回答被网友采纳
相似回答