Solution: Favorite Cities Vector

The main() function uses a vector to store and print a list of city names.

  • Declares a vector of strings named cities containing three elements: "Tokyo", "New York", and "Sydney".

  • Prints the heading "Some cities I like:" using cout.

  • Uses a for loop that runs from i = 0 to i < cities.size(), printing each city name stored in the vector.

  • Displays each city on a new line in the output.

  • Ends with return 0; to indicate successful program completion.

Solution: Favorite Cities Vector

The main() function uses a vector to store and print a list of city names.

  • Declares a vector of strings named cities containing three elements: "Tokyo", "New York", and "Sydney".

  • Prints the heading "Some cities I like:" using cout.

  • Uses a for loop that runs from i = 0 to i < cities.size(), printing each city name stored in the vector.

  • Displays each city on a new line in the output.

  • Ends with return 0; to indicate successful program completion.