一起来找茬 下面这段代码是让计算机读入两个整数,分别放到变量a和变量b 中,并将变量a和变量b中的数交换。其中有两个错误,快来改正吧!
修改后:
#include <stdio.h>
#include <stdlib.h>
int main( )
{
int a, b,t;
scanf("%d%d", &a, &b);
t=a;
a=b;
b=t;
printf("%d %d", a, b);
system("pause");
return 0;
}
运行效果:
一起来找茬 下面这段代码是让计算机读入两个整数,分别放到变量a和变量b 中,并将变量a和变量b中的数交换。其中有两个错误,快来改正吧!
修改后:
#include <stdio.h>
#include <stdlib.h>
int main( )
{
int a, b,t;
scanf("%d%d", &a, &b);
t=a;
a=b;
b=t;
printf("%d %d", a, b);
system("pause");
return 0;
}
运行效果: