For example:
Adam Peter Eric
John Edward
Wendy
I wanted to store in 3 strings array (each line represents an array), but I am stuck on how to read it line by line.
Here is my code:
string name [3][3] ;
ifstream file ("TTT.txt");
for (int x = 0; x < 3; x++){
for (int i = 0; x < 3; i++){
while (!file.eof()){
file >> name[x][i];
}
}
}
cout << name[0][0];
cout << name[0][1];
cout << name[0][2];
cout << name[1][0];
cout << name[1][1];
cout << name[2][0];
}