信息学奥赛一本通(C++版)在线评测系统
http://ybt.ssoier.cn:8088/problem_show.php?pid=2064
2064:【例2.1】交换值
【题目描述】
输入两个正整数a和b,试交换a、b的值(使a的值等于b,b的值等于a)。
【输入】
输入两个正整数a和b。
【输出】
输出a与b交换值后的结果。
【输入样例】
2 3
【输出样例】
3 2 #include <bits/stdc++.h> using namespace std; int main(){ int n,m; cin>>n>>m; swap(n,m); cout<<n<<" "<<m; }
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,m;
cin>>n>>m;
swap(n,m);
cout<<n<<" "<<m;
}