Reading selective numbers from a file
Hello there all,
I have a question regarding file-processing. I have this list of numbers and each numbers:
2 3
9 7 5
8 4 10
1 6
The first element(2) represents the number of rows this "matrix" has, and the second number,(3) represents the number of columns. Elements {9,7,5,8,4,10} is the matrix and the last two elements(1 and 6) are two special numbers start and goal.
Basically I know how to read a file from top to bottom I just do not know how to read each element and stop.
For instance
Code:
//first element need to go into variable int numrows.
// second element(3) needs to go into variable int numcols.
// every row needs to go into an array of new int[numcols]
// start variable (1) has to go into variable int start
// goal variable (6) has to go into variable int goal
Please help me get started on this little exercise. Thank you.