Garmaine Staff asked 1 year ago

I am currently working on a project for an intro course to C++ and I am stumped on a portion of a project that I am working on. The premise of the project is to create a flight seat reserving program. I am having trouble displaying the layout of the seats from an input file to the program. Currently it prints the information all on one line and doesn't keep the formatting. Here is the code so far:

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

using namespace std; 

void displaySeats(char seatChart[10][7]) {
    ifstream inFile;
    string fileName2 = "chartIn.txt";

    string line;;

    if (inFile.is_open())
        for (int i = 0; i < 10; i++) {
            for (int j = 0; j < 7; j++) {
                inFile >> seatChart[i][j]; 
                cout << seatChart[i][j];


int main() {

    char seatChart[10][7];



Here is the information on the input file I need to display in the program.

1     A         B        C        D          E        F
2     A         B        C        D          E        F        
3     A         B        C        D          E        F
4     A         B        C        D          E        F
5     A         B        C        D          E        F
6     A         B        C        D          E        F
7     A         B        C        D          E        F
8     A         B        C        D          E        F
9     A         B        C        D          E        F
10    A         B        C        D          E        F

Any help would be much appreciated!