Category : 2d-vector

I am trying to take values in a 2d vector called alloc from the user but the alloc zero index is the only changed index and the values of each index override it i don’t know why (i.e: only the first index of the 2d vector is affected) Code: cout<<"Please Enter n"<<endl; cin>>n; cout<<"Please Enter ..

Read more

let’s say I have a vector storing vectors of strings. std::vector<std::vector<std::string>> MyVec = { {}, {} } I want to use anything equivalent to .push_back(X) such that the vector will now look as following: { {X}, {} }. Does anyone have an idea for a way to solve this? Source: Windows Que..

Read more

How can I access 2d vector using auto iterator? I write a code using auto iterator but it is not run just showing: – Compilation Error: Compilation Error prog.cpp: In member function std::vectorstd::vector<int > Solution::sortedMatrix(int, std::vectorstd::vector<int >): prog.cpp:18:31: error: no match for operator[] (operand types are std::vectorstd::vector<int > and __gnu_cxx::__normal_iteratorstd::vector<int*, std::vectorstd::vector<int > >) for(auto col ..

Read more