執行 ❯
建立您
自己的
網站
×
更改方向
更改主題,深色/淺色
前往 Spaces
#include <iostream> #include <set> using namespace std; int main() { // Create a set called cars that will store strings set<string> cars = {"Volvo", "BMW", "Ford", "Mazda"}; // Add new elements cars.insert("Tesla"); cars.insert("VW"); cars.insert("Toyota"); cars.insert("Audi"); // Print set elements for (string car : cars) { cout << car << "\n"; } return 0; }
奧迪
寶馬
福特
Mazda
特斯拉
豐田
VW
沃爾沃