运行 ❯
获取您
自己的
网站
×
更改方向
更改主题,深色/浅色
前往 Spaces
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int a = 10, b = 25; cout << "Before: a = " << a << " | b = " << b << "\n"; swap(a, b); cout << "After: a = " << a << " | b = " << b << "\n"; return 0; }
之前:a = 10 | b = 25
之后:a = 25 | b = 10