#include<cstdio>#include<iostream>using namespace std;int swap(int *a, int *b){ int t = *a; *a = *b; *b = t; cout<<*a<<":"<<*b<<endl;}int main(){ int x1, y1; cin>>x1>>y1; swap(x1, y1); cout<<x1<<" "<<y1<<endl; int x2, y2; cin>>x2>>y2; swap(&x2, &y2); cout<<x2<<" "<<y2<<endl;}
2 回答
流浪_老
TA贡献71条经验 获得超14个赞
#include<cstdio>
#include<iostream>
using namespace std;
void swap(int *a, int *b){
int t = *a;
*a = *b;
*b = t;
cout<<*a<<":"<<*b<<endl;
}
int main()
{
int x1, y1;
cin>>x1>>y1;
swap(&x1, &y1);
cout<<x1<<" "<<y1<<endl;
int x2, y2;
cin>>x2>>y2;
swap(&x2, &y2);
cout<<x2<<" "<<y2<<endl;
}
- 2 回答
- 0 关注
- 1758 浏览
添加回答
举报
0/150
提交
取消