W3School TIY Editor

  • W3School 在线教程
  • 改变方向
  • 暗黑模式
​x
 
#include <iostream>
#include <set>
using namespace std;
​
int main() {
  // 创建存储汽车品牌的集合 cars 
  set<string> cars = {"Volvo", "BMW", "Ford", "Tesla"};
​
  // 打印集合中的汽车品牌 
  for (string car : cars) {
    cout << car << "\n";
  }
  return 0;
}