

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


To print elements of C++ vector, you can use any of the looping statements or foreach statement.
In the following program, we shall use C++ Foreach statement to print the elements of vector. C++ Program Output
In the following program, we shall use C++ While Loop to print the elements of vector from starting to end. We shall use index to access an element of vector during each iteration. C++ Program
#include
Output
In the following program, we shall use C++ For Loop to print the elements of vector. As in while loop, we shall use index to access elements of vector in this example as well. C++ Program Output #include