2d array

Joined
Oct 6, 2006
Messages
1
Reaction score
0
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");
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top