This is the text file which is called grades.txt :
John   Sebastian    90  80   85  90     75 70  89 80 90       86 88 89 99 100  
Brown  Ford         40  60   80  85     60 90 100 80 90       83 81 89 97 90
I need to read all the data and put them in separate arrays. First 4 grades are exams , second are quizzes and third are homeworks.
#include <iostream>
#include <fstream>
using namespace std;
void letter_grade(string names[][2], int exams[][4], int quiz[][5], int homeworks[][5], float grades[2][2]);
int main() {
ifstream Openfile("grades.txt");
string names[2][2];
int exams[4][4];
int quiz[5][5];
int homeworks[5][5];
if(Openfile.is_open()){
for(int i = 0 ; i<2 ; i++){
    Openfile >> names[i][0];
}
    for(int j = 0 ; j<2; j++){
        Openfile >> names[j][1];
    }
}
    else{
    cout << "File is not open." << endl;
}
if(Openfile.is_open()){
    for(int x = 0 ; x<4 ; x++){
        for(int y = 0; y<4 ; y++){
            Openfile >> exams[x][y];
        }
    }
}
    return 0;
}
So arrays I've planned will be like this :
names[0][0] = John
names[1][0] = Sebastian 
names[0][1] = Brown
names[1][1] = Ford        
and so on. But I couldn't manage to do that , instead code keeps reading the exam results and writing them into the names array.
Then I will be calculating the grades of these students from arrays and save the result on a different file which I will do if I can read the data off the text file.