-
File Reading
Say I have a file like:
2345##23
4######3
222#678#
and say I want to give this file to main as an argument.
and I want main to read the file and put the data
in a multidimensional array like:
int myarray[7][3];
after the process myarray should contain data
like this:
myarray[0][0] will be 2
myarray[0][1] will be 4
and so on...
how can I do it?
thanks for helping:):):)
-
you will either need to use a char array or ignore the # signs storing a default number in it's place.
you need to use nested loops to read in the data in a sequential fashion.
for(i \\etc.
{
for(j \\etc
inputStream >> array[i][j];
}
}