(1)有两个瓶子A和B,分别盛有醋和酱油,要求它们互换(即A瓶原来盛醋,现改盛酱油,B瓶则相反).
①#include
int main(){
int A,B,t;
scanf("%d%d",&A,&B);
t=A;
A=B;
B=t;
printf("%d %d\n",A,B);
return 0;
}
②#include
void a(int A,int B){
int t;
t=A;
A=B;
B=t;
printf("%d %d\n",A,B);
}
int main(){
int A=2;
int B=3;
a(A,B);
}
原文:https://www.cnblogs.com/cylf/p/10567552.html