Hello there, My program is supposed to read data from a txt file, and put this data in a 2 dimension array. All I have is the last line of data in my text file. My teacher said that I have to update the array in my loop. I have no idea how to do it. Can someone help me? Nicole
example of txt file
1 2 3
4 5 6
...
int main()
{
const int TYPE = 3;
const int COUNTRY = 50;
int result[COUNTRY][TYPE] = {0};
int totalPoint[COUNTRY] = {0};
int numGold,numSilver,numBronze;
int cntCountry = 0;
int totalMedal = 0;
while(!cin.eof() )
{
cin >> numGold >> numSilver >> numBronze;
if(numGold > 0 || numSilver > 0 || numBronze > 0)
{
++cntCountry;
}
}
for ( int i = 0; i < cntCountry; ++i )
{
result[i][0] = numGold;
result[i][1] = numSilver;
result[i][2] = numBronze;
}