Part of my assignment is to read from a data file using a 2 dimensional array (essentially we have to make a factory production type program that we can read/write too and a few other things). The problem I'm having is that when I try and run it the console just spits out 0's upon 0's.
inFile >> factory[0][0]; read in the first digit of your file only. Then, you tried outputting the array, which, printed zeroes. I'm surprised, since it wasn't initialized, that it didn't spew out large numbers instead. Anyway, you first have to read the file into each array cell, like so..
1 2 3 4 5 6 7 8 9 10
while (!inFile.eof())
{
for(int a=0; a<fac; a++) // Since fac is a const, you really can't use it in a for loop
{
for(int b=0; b<shift; b++) //Since shift is a const, you really can't use it in a for loop
{
inFile >> factory[a][b];
}
}
}