Im trying to do a population vector assignment. I tried to comment my word so you know waht is going on .
I am having trouble putting coefficents into a two dimensional vector array. So if you could give me hints on that it would be great. The code only compiles until that two demesional array which is where it asks for the coeffiecents.
using namespace std;
int numN = 0, years, print;
vector <double> nzones(numN);
vector <vector <double> > coeff (numN, vector<double>(numN));//2d array
cout << "Enter the number of N areas in the area." << endl;//number or areas
cin >> numN;
if (numN <= 0 )//test statement for areas greater than 0.
cout << "That is not a valid number." << endl;
for ( int i = 0; i < zones.size(); i++ )//enter populations into a 1-d array.
cout << "Enter the populations for the given number of areas." << endl;
cin >> zones[i];
cout << "How many years do you want to calculate?" << endl;//number of years to calculate
cin >> years;
cout << "How often do you want to print the calculated population data?" << endl;//how often to print every so many years
cin >> print;
for ( int j = 0; coeff.size(); j++ )// puts coeffiecients into a 2d array.
for ( int f = 0; coeff.size(); f++ )
cout << "Enter the population coefficients for the given number of areas." << endl;
cin >> coeff[j][f];
for ( int z = 0; z <= years; z++ )//loop to calculate area populations for so many years.
for ( int p = 0;nzones.size(); p++ )//places populations into nzones.
nzones[p] = zones[p];
for( int l = 0; zones.size(); l++ )//actual calculation of populations times coefficents
nzones[p] = zones[p] + coeff[p][l] * zones[l];
for ( p = 0; p < numN; p++ )//places new zones populations into zones.
zones[p] = nzones[p];
if ( z % print == 0)// prints every so many times.
for (int k = 0; k < numN; k++)
cout << nzones[k] << endl;