0
The contents of my vector are the data I wish to place in the matrix:
int main()
{
vector<int> dados;
int valores[4];
string val;
ifstream arq ("matriz.txt");
if(arq.is_open())
{
while(! arq.eof())
{
getline(arq, val);
int num;
stringstream ss(val);
while(ss >> num)
{
dados.push_back(num);
}
}
// mais codigos aqui
}
}
In C++:
void Matrix::IniMatrix(int *vetor)
{
for(int i=0; i<getLinha(); i++)
{
for(int j=0; j<getColuna(); j++)
{
elem[i][j] = vetor[1]; // int **elem (este é o tipo que esta declarado elem)
}
}
}
How does the first code relate to the second ? is trying to pass a native vector,
int []
or a class vectorvector
, onevector<int>
?– Isac