Looping vertically through a vector that form a grid

  2d-vector, c++, loops, string, vector

I have a vector a strings, witch is basically a grid.

vector<string> tempo(0);
bla
blooper
vroom
yahoo

i would like iterate the columns and i forgot how.
not all of the string are of the same length.

the end result should be a new vector of strings:

bbvy
llra
aooh
ooo
pmo
e
r

how it’s done again?
this is that i have done sofar.

for(size_t z = 0; z < tempo.size(); z++){
    for(size_t x = 0; x < tempo[z].length(); x++){
        std::cout << tempo[z].at(x);
    }
    std::cout << endl;
}

it’s close, but not perfect.

Source: Windows Questions C++

LEAVE A COMMENT