In: Computer Science
Create a 15 row and 4 column table with each column of the data so that it goes 1A 1B 1C 1D across using this code as a base
void PrintSeatingChart(seat seats[15][4], int numRows, int
numColumns) {
   int i;
   int j;
   for (i = 0; i < numRows; i++) {
       cout << i + 1 << "
";
       for (j = 0; j < numColumns; j++)
{
           cout <<
seats[i][j].seatLetter << " ";
       }
       cout << endl;
   }
}
Please find the answer below.
Please do comments in case of any issue. Also, don't forget to rate
the question. Thanks.
main.cpp
#include <iostream>
#include<sstream>
#include <iomanip>
using namespace std;
struct seat{
   string seatLetter;
};
void PrintSeatingChart(seat seats[15][4], int numRows, int
numColumns) {
   int i;
   int j;
   for (i = 0; i < numRows; i++) {
       cout << setw(5) << left
<< i + 1;
       for (j = 0; j < numColumns; j++)
{
           cout <<
setw(5) << left << seats[i][j].seatLetter;
       }
       cout << endl;
   }
}
void GetSeatingChart(seat seats[15][4], int numRows, int
numColumns) {
   int i;
   int j;
   string row;
   for (i = 0; i < numRows; i++) {
       char col='A';
       stringstream ss;
       ss<<(i+1);
       for (j = 0; j < numColumns; j++)
{
          
ss>>row;
          
seats[i][j].seatLetter=row+col;
           col +=1;
       }
   }
}
int main( ){
   seat seats[15][4];
   GetSeatingChart(seats,15,4);
   PrintSeatingChart(seats,15,4);
   return 0;
}
