运行 ❯
获取您
自己的
网站
×
更改方向
更改主题,深色/浅色
前往 Spaces
#include <iostream> #include <vector> using namespace std; int main() { vector<string> cars = {"Volvo", "BMW", "Ford", "Mazda"}; vector<string> fruits = {"Apple", "Banana", "Cherry", "Orange"}; cars.swap(fruits); cout << "Cars:\n"; for (string car : cars) { cout << car << "\n"; } cout << "\nFruits:\n"; for (string fruit : fruits) { cout << fruit << "\n"; } return 0; }
汽车
苹果
香蕉
樱桃
橙子
水果
沃尔沃
宝马
福特
马自达