Answers for "how to print the contents of a vector c++"

C++
10

cpp print vector

for(int i = 0; i < vec.size(); i++)
    std::cout << vec[i] << ' ';
Posted by: Guest on January-22-2021
1

print vector

#include <vector> // vector 
#include <iostream> // cout 
using namespace std;

int main()
{
    vector<int> tmp = {1,2,3,4,5,6};
    for (auto i : tmp) {
        cout << i << ' ';
    }
}
Posted by: Guest on November-12-2021
2

print vector of vector c++

for (int i = 0; i < vec.size(); i++)
{
    for (int j = 0; j < vec[i].size(); j++)
    {
        cout << vec[i][j];
    }
}
Posted by: Guest on November-12-2021
0

print vector c++

std::vector<char> path;
// ...
for (char i: path)
    std::cout << i << ' ';
Posted by: Guest on November-23-2021

Code answers related to "how to print the contents of a vector c++"

Browse Popular Code Answers by Language