i am trying to make a matrix, and gradually make it more complex, currently i am running into the problem of it not actually making the matrix.
Code:
#include <vector>
#include <iostream>
#include <string>
#include "input.h"
using namespace std;
void mak_matrix(int cols,int rows);
void mak_matrix(int cols,int rows)
{
vector <vector<float> >matrix;
vector<float>col;
for(int i=0;i<cols;i++)
{col.push_back(0.0);}
for(int j=0;j<rows;j++)
{matrix.push_back(col);}
col.clear();
}
int main()
{
vector <vector<float> >matrix;
vector<float>col;
int cols=readInt("Number of columns is ",false);
int rows=readInt("Number of rows is ",false);
cout<<"done inputing data"<<endl;
void mak_matrix(int cols,int rows);
cout<<"done making matrix"<<endl;
cout<<matrix[cols][rows]<<endl;
cout<<"size of matrix"<<endl;
matrix[0][0]=3.0;
matrix[0][1]=2.0;
matrix[1][0]=1.0;
matrix[1][1]=3.0;
matrix[2][0]=4.0;
matrix[2][1]=6.0;
cout<<"done input values"<<endl;
cout<<matrix[0][0]<<" "<<matrix[0][1]<<endl;
cout<<matrix[1][0]<<" "<<matrix[1][1]<<endl;
cout<<matrix[2][0]<<" "<<matrix[2][1]<<endl;
return 0;
}
it used to get to the inputing matrix values before i had it try to check the size of the matrix, I am not accustomed with trying to do things like this, any help is appreciated.