Hey guys I'm trying to write a method to create vectors named y_i where i starts at 1 and ends at a variable names rows for entering a matrix. I'm trying to write it so that it dynamically adds enough vectors to this code. Vectors of the form vector y_1, vector y_2 etc etc.
Code is below. My questions are am I doing this right? do I need a struct? A class? Help!
#include <iostream>
#include <vector>
using namespace std;
int i, rows;
vector<vector< double > >matrix;
void VectorCreation(int rows)
{
for (i = 1; i <= rows; i++)
{
new vector<double>;
}
}
int main()
{
cin >> rows;
VectorCreation(rows);
return 0;
}