Say I have a text file named "matrix.txt" and it looks like this...
3
5 7 10
5 3 2
0 6 8
The first number on the line is the number of rows and columns there will be (there will always be the same number of rows and columns). After that there is the matrix. I've tried to make it work, but I keep getting the error "matrixA was not declared in this scope". I feel like there must be an easier way to do this. Any ideas?
If you want to use pointers for the array the above int** matrixA=newint*[matrixSize];
is the way to go. You can however declare it as a static array once you have the size as: int matrixA[matrixSize][matrixSize];
When I do the "file >> num" command it only inputs the last number of the line (for example 10 on line 2). How do I input each number seperatly and ignore the spaces?