引进第三变量(t为临时变量):
#include<iostream>
using namespace std;
int main()
{
int t, x, y;
cin >> x >> y;
t = x;
x = y;
y = t;
cout << x << y;
}
不引进第三变量:
#include<iostream>
using namespace std;
int main()
{
int x, y;
cin >> x >> y;
x = x + y;
y = x - y;
x = x - y;
cout << x << y;
}
觉得有帮助就给博主点下关注叭~~
有问题的可以私信或者在评论区一起交流
友友们一起加油叭QAQ