Brief :-
How to make multiple vectors ?
We generally make vectors using - vector<int> vector_name;
But any method to make multiple vectors at once ?
CodePudding user response:
I assume that you're trying to create multiple vector
at once and store them. You can use a simple for loop, or use a vector of vectors!
For example:
#include <vector>
// Using a for loop
//#define VECTOR_COUNT 5 (EDIT)
constexpr int VECTOR_COUNT = 5;
std::vector<int> myFiveVectors[VECTOR_COUNT];
for(int i = 0; i < VECTOR_COUNT; i )
myFiveVectors[i] = {1, 2, 3};
// Using vector of vectors
std::vector<std::vector<int>> myVectors{};
myVectors.push_back({1, 2, 3});