KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
How do I find the size of a 2 dimensional vector? So far I have the following code which doesn't compile. #include <iostream> #include <vector> using namespace std; int main() { vector < vector <int> > v2d; for (int x = 0; x < 3; x++) { for (int y = 0; y < 5; y++) { v2d.push_back(vector <int> ()); v2d[x].push_back(y); } } cout<<v2d[0].size()<<endl; cout<<v2d[0][0].size()<<endl; return 0; }
Tags (comma-separated)
Save Edits
Cancel