W3School TIY Editor

  • W3School 在线教程
  • 改变方向
  • 暗黑模式
​x
 
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
​
int main() {
  int a = 10, b = 25;
  cout << "交换前: a = " << a << " | b = " << b << "\n";
  swap(a, b);
  cout << "交换后: a = " << a << " | b = " << b << "\n";
  return 0;
}