Hi,
I'm trying to iterate through a file and output each number as a double separately so I can input it into a multidimensional array and perform matrix operations on it.
1 2 3 4 5 6 7 8 9 10 11 12 13
ifstream myfile;
myfile.open(file); // Opens file
istream_iterator<double> id(myfile);
for (; id != istream_iterator<double>(); id++) {
int j = 0;
for (int i = 0; i < sizeN; i++) {
Matrix[i][j] = *id;
if(i == (sizeN - 1)) {
j++;
i = 0;
}
}
}
It doesn't seem to be working though, it is getting stuck somewhere in there and I can't seem to figure it out.
Help please
NOTE : Iv been coding in C a bit so if what im doing here is totally wrong that might be the reason..