{{#items}}

{{text}}

{{/items}} {{ctaText}}

{{#items}} {{/items}}

showing results for - "show a 4d vector in c 2b 2b"

Gianluca

17 Mar 2016

```
1// A recursive function able to print a vector
2// of an arbitrary amount of dimensions.
3template<typename T>
4static void show(T vec)
5{
6 std::cout << vec;
7}
8
9
10template<typename T>
11static void show(std::vector<T> vec)
12{
13 int size = vec.size();
14 if (size <= 0) {
15 std::cout << "invalid vector";
16 return;
17 }
18 std::cout << '{';
19 for (int l = 0; l < size - 1; l++) {
20 show(vec[l]);
21 std::cout << ',';
22 }
23 show(vec[size - 1]);
24 std::cout << '}';
25}
```

similar questions

c 2b 2b sum a vector of digitsinitialize 2d vector of ints c 2b 2bstd vector c 2b 2bstoring matrix in vectordeclare vector of size n in c 2b 2bc 2b 2b print vector without loopvector2 c 2b 2bthe statement vector vector int matrix 28100 vector int 2850 100 29 29 declareshow to find the mode of a vector c 2b 2bprint 2d vector c 2b 2b2d vector printinitialize all elements of vector to 0 c 2b 2bsize of a matrix using vector c 2b 2bstore arbitrarly large vector of doubles c 2b 2bhow to get size of 2d vector in c 2b 2bqueries leading to this page

print a 2d vector c 2b 2bhow to define a 3d vector in c 2b 2b3d vector c 2b 2bhow to print 2d vector c 2b 2bvector show c 2b 2bvector print c 2b 2bshow vector in c 2b 2bdisplay elements in vector c 2b 2bhow to declare 3d vector in c 2b 2bhow to make a 3d vector c 2b 2bprint 2d vector c 2b 2bdisplay a vector in c 2b 2bhow to create a 3d vector c 2b 2bshow vector in vector in vector in c 2b 2bc 2b 2b display vectorhow do i print elemnts in a 2d vector c 2b 2bprinting a vector c 2b 2bhow to display a vector in c 2b 2bprint 2d vector in cppshow a vector in c 2b 2bhow to print from 2d vector cppprint all elements of 2d vector2d vector printprint a vector c 2b 2bprint a 2d vector in cppprint 2d array c 2b 2bways to print 2d array in c 2b 2bvector c 2b 2b printhow to find size of multidimensional vector in c 2b 2bdisplay a vector c 2b 2bprint element of 2d vectorc 2b 2b how to display vectorprint 2d array in c 2b 2bprint multidimensional vector c 2b 2bdisplay vector c 2b 2bprinting vector c 2b 2bc 2b 2b 3d vectorc 2b 2b show vector elementsshow vector in vector in c 2b 2bhow to display vector in c 2b 2bshow vectorprint vector c 2b 2bprint a vector in c 2b 2bshow in vector c 2b 2bdisplay elements of vector in c 2b 2bprinting a vector in c 2b 2b3d vector in c 2b 2bprint vector in c 2b 2bc 2b 2b display vector elementsprinting 2d array c 2b 2bshow a 4d vector in c 2b 2b your answer for

you will get a confirmation link on this - you will have to click that for successful submission of your answer. we require this to keep the website free of spam, bots and unhelpful content

please ensure to add code which is syntactically corrent and executes properly

ask question on maxinterview

you will get a confirmation link on this - you will have to click that for successful submission of your question. we require this to keep the website free of spam, bots and unhelpful content

please be clear, to the point and respectful