Your while
loops iterate until the end of file, you don't need them.
while (inFile >> seat) // This reads until the end of the plane.
Use instead (without the while
):
for (int a = 0; a < FC_Row; a++) // Read this amount of rows.
for (int b = 0; b < FC_Col; b++) // Read this amount of columns.
inFile >> firstClass[a][b] ; // Reading the next seat here.
Apply the same for economic seats.
Also you might want change arrays into vectors, since variable size arrays are hell.
vector<vector<int> > firstClass(FC_Row, vector<int>(FC_Col)) ;
vector<vector<int> > economyClass(EconRow, vector<int>(EconCol)) ;
You need to #include <vector>
to use vectors, their access is identical to arrays.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…