In: Computer Science
Given numRows and numCols, print a list of all seats in a theater. Rows are numbered, columns lettered, as in 1A or 3E. Print a space after each seat, including after the last. Ex: numRows = 2 and numCols = 3 prints:
1A 1B 1C 2A 2B 2C
#include <iostream>
using namespace std;
int main() {
int numRows = 2;
int numCols = 3;
// Note: You'll need to define more variables
/* Your solution goes here */
cout << endl;
return 0;
}
C++ Program:
/* C++ Program that prints Seating arrangement of a movie theater given number of rows and number of columns */
#include <iostream>
using namespace std;
//Main function
int main()
{
//Holding number of rows and columns
int numRows = 2;
int numCols = 3;
int i,j;
cout << endl << endl << " Seating Arrangement: " << endl << endl;
//Outer loop runs for Rows
for(i=1; i<=numRows; i++)
{
//Inner loop runs for columns
for(j=1; j<=numCols; j++)
{
//Printing number
cout << i;
//Creating Character and printing Letter
cout << (char)(j+64) << " ";
}
//printing a new line
cout << endl;
}
cout << endl;
return 0;
}
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
Sample Output: