Hi I am new to this forum and to c++.I am having problems reading data from a txt file into a 2d array. The data is in the file like this
1 5 87
3 3 24
2 4 62
4 2 22
I am only suppose to read in the 3rd column into the array. I am opening the file but the data that I am see is not the data in the file. Here is the code. Please help.
for(int i = 0; i <rows; i++)
{
inFile.read(wksales, columns);
}
for( i = 0; i < 4;i++)
{
for(int j = 0; j <5;j++)
{
printf("%2d ", wksales[j]);
}
printf("\n");
}
1 5 87
3 3 24
2 4 62
4 2 22
I am only suppose to read in the 3rd column into the array. I am opening the file but the data that I am see is not the data in the file. Here is the code. Please help.
for(int i = 0; i <rows; i++)
{
inFile.read(wksales, columns);
}
for( i = 0; i < 4;i++)
{
for(int j = 0; j <5;j++)
{
printf("%2d ", wksales[j]);
}
printf("\n");
}