Run ❯
Get your
own
website
×
Change Orientation
Change Theme, Dark/Light
Go to Spaces
#include
#include
using namespace std; int main() { vector
cars = {"Volvo", "BMW", "Ford", "Mazda"}; vector
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; }
Cars:
Apple
Banana
Cherry
Orange
Fruits:
Volvo
BMW
Ford
Mazda