1. ## 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```

2. ## Clearer Description

Hey all,
I have a clearer idea of what I need to do. I need to basically read an input file that has matrix elements in it.
Code:
```Ex:
2 3
9 7 5
8 4 10
1 6

2 - int numrows;
3 - int numcols;
{(9,7,5),(8,4,10)} - matrix elements
1 - int start;
6 - int goal;```
I need to read the matrix elements and place them in a 2-D array.
Code:
```|9 7 5|
|8 4 10|```
I am guessing we need to use the numrows and numcols but we can ignore the start and goal variables for now. Would someone please help me along with this? Any feedback is appreciated as always. Thank you.

3. just use two for loops, assuming you have all ready declared the appropiate size of the 2d array. So the first for loop would be your row index in this case 2, and the inner loop would be your columns, 3.
Code:
```for(int i=0; i < Row; i++)
for(int j=0; j < Col; j++)
InFile >> Array[i][j];```

4. ## yeah I know... but

well, of course. Populating the array is not too hard. I just need to get the values out of the file that I am reading from ... the right values that is... any ideas?

5. that code will get the data out of the file, where InFile is the filestream created.