C语言程序设计 功能:实现两个整数的交换.例如:给a和b分别输入:60和65,输入为:a=65 b=60

问题描述:

C语言程序设计 功能:实现两个整数的交换.例如:给a和b分别输入:60和65,输入为:a=65 b=60
#include
#include
void wwjt();
void fun(int *a,int *b)
{
//
}
main()
{
int a,b;
printf("Enter a,b:");
scanf("%d%d",&a,&b);
fun(&a,&b);
printf("a=%d b=%d\n",a,b);
wwjt();
}
void wwjt()
{
FILE *IN,*OUT;
int a,b,n;
IN=fopen("in.dat","r");
if(IN==NULL)
{
printf("Read FILE Error");
}
OUT=fopen("out.dat","w");
if(OUT==NULL)
{
printf("Write FILE Error");
}
for(n=0;n
1个回答 分类:综合 2014-12-11

问题解答:

我来补答
void fun(int *a,int *b)
{
int c=0;
c=*a;
*a=*b;
*b=c;
return;
}
 
 
展开全文阅读
剩余:2000