作者在 2009-10-16 09:36:03 发布以下内容
#include<stdio.h>
Swap(int &x,int &y)/*用引用来表示*/
{
int type;
type=x,x=y,y=type;
return 0;
}
main ()
{
int a,b;
scanf("%d%d",&a,&b);
printf("the first value:a=%d,b=%d\n",a,b);
Swap(a,b);
printf("after swap value:a=%d,b=%d\n",a,b);
return 0;
}
{
int type;
type=x,x=y,y=type;
return 0;
}
main ()
{
int a,b;
scanf("%d%d",&a,&b);
printf("the first value:a=%d,b=%d\n",a,b);
Swap(a,b);
printf("after swap value:a=%d,b=%d\n",a,b);
return 0;
}