输入两个变量的值,交换两者取值后输出。
来源:百度知道 编辑:UC知道 时间:2024/05/31 04:38:10
VC++
#include<stdio.h>
main()
{
int a,b,temp;
printf("please input the two numbers:\n");
scanf("%d,%d",&a,&b);
printf("Old a=%d,b=%d\n",a,b);
temp=a;
a=b;
b=temp;
printf("New a=%d,b=%d\n",a,b);
}
int temp;
scanf("%d %d",&a,&b);
temp=a;
a=b;
b=temp;
printf("%d,%d",a,b);
你要用什么语言写呢?vb还是c++呢?