print vector 1

print vector

for(int i = 0; i < vec.size(); i++)
    std::cout << vec[i] << ' ';

Here is what the above code is Doing:
1. We create a vector of integers.
2. We use the push_back() function to add elements to the vector.
3. We use the size() function to get the size of the vector.
4. We use the at() function to access the elements of the vector.
5. We use the [] operator to access the elements of the vector.
6. We use the begin() and end() functions to iterate through the vector.
7. We use the for loop to iterate through the vector.

Similar Posts