In this program i want to input several city names and display only those beginning with "B" or "C".my code is displaying the city name just after inputting the city name.
I want to display all the city name beginning with B or C together after inputting all of them.
Instead of printing the cities right away you could add them to a vector (or array) and when the loop has ended you can loop through the cities and print them.