two dimensional array reading from textfile

my program is supposed to read 16 numbers from a file and input them into a two dimensional array. I then have to print a name then four of these numbers, end the line, print a second name then four more numbers, end the line, print a third name then four more numbers, end the line, print a fourth name then end the line. then under each column it's supposed to get the total for the four numbers in that column. at the end of each row, it's supposed to get each of the values in that row and multiply it by another value and display it.

I need help, I'm stuck and can't go past this. Any help is appreciated it, thank you.



#include<iostream>
#include<iomanip>
#include<string>
#include<fstream>

using namespace std;

int main()
{
ifstream infile;
infile.open("myheb.txt");//the text file has 16 numbers

int quant[4][4]; //creates a 4*4 2d array.

for(int x=0; x<4; x++)
{
for(int y=0; y<4; y++)
{
infile>>quant[x][y];

}
}

for(int x=0; x<4; x++) //This loops on the rows.
{

for(int y=0; y<4; y++) //This loops on the columns
{
cout << quant[x][y] << " ";
}
cout << endl;
}

system("pause");
return 0;
}
Topic archived. No new replies allowed.