Question

In: Computer Science

Given numRows and numCols, print a list of all seats in a theater. Rows are numbered,...

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;
}

Solutions

Expert Solution

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:


Related Solutions

Given numRows and numColumns, print a list of all seats in a theater. Rows are numbered,...
Given numRows and numColumns, 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. Use separate print statements to print the row and column. Ex: numRows = 2 and numColumns = 3 prints: 1A 1B 1C 2A 2B 2C import java.util.Scanner; public class NestedLoops {    public static void main (String [] args) {       Scanner scnr = new Scanner(System.in);      ...
Given numRows and numCols, print a list of all seats in atheater. Rows are numbered,...
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#includeint main(void) {int numRows = 2;int numCols = 3;// Note: You'll need to declare more variables/* Your solution goes here */printf("\n");return 0;}
Given numRows and numColumns, print a list of all seats in a theater. Rows are numbered, columns lettered, as in 1A or 3E.
4.8.2: Nested loops: Print seats. C++Given numRows and numColumns, 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 numColumns = 3 prints:1A 1B 1C 2A 2B 2C#includeusing namespace std;int main() {int numRows;int numColumns;int currentRow;int currentColumn;char currentColumnLetter;cin >> numRows;cin >> numColumns;/* Your solution goes here */cout << endl;return 0;}
in java Print a list of seats in a theater. Rows are numbered, columns lettered, as...
in java Print a list of seats in a theater. Rows are numbered, columns lettered, as in 1A or 3E. Print a space after each seat. Create a nested loop to print the following: 1A 1B 1C 1D 3A 3B 3C 3D 5A 5B 5C 5D
SOLVE IN C: Given numRows and numColumns, print a list of allseats in a theater....
SOLVE IN C: Given numRows and numColumns, 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 numColumns = 3 prints:1A 1B 1C 2A 2B 2C
A Theater has n numbered seats, and n tickets are distributed among n persons. Compute the...
A Theater has n numbered seats, and n tickets are distributed among n persons. Compute the probability that (a) exactly two persons will be seated at seats corresponding to their ticket numbers if all the seats are occupied at random. (b) at least two persons will be seated at seats corresponding to their ticket numbers if all the seats are occupied at random.
A theater has 500 seats, divided into orchestra, main, and balcony seating. Orchestra seats sell for...
A theater has 500 seats, divided into orchestra, main, and balcony seating. Orchestra seats sell for $50, main seats for $35, and balcony seats for $25. If all the seats are sold, the gross revenue to the theater is $17,100. If all the main and balcony seats are sold, but only half the orchestra seats are sold, the gross revenue is $14,600. How many balcony seats are there?
A movie theater is planning to offer the possibility to book the seats either online or...
A movie theater is planning to offer the possibility to book the seats either online or at the kiosk of the theater. Design the booking application for the theater taking in account the following consideration: - The theater has 100 seats only. - More than one user may be trying to book the same seat at the same time. - Any seat can be booked by only one user. - A seat can be available for the kiosk agent and...
Write a pseudocode for the following: given that a path is a hamiltonian path, print all...
Write a pseudocode for the following: given that a path is a hamiltonian path, print all its edges.
I am having a difficult time with this loop. Needs to be in C++. Given numRows...
I am having a difficult time with this loop. Needs to be in C++. Given numRows and numColumns, 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 numColumns = 3 prints: 1A 1B 1C 2A 2B 2C #include <iostream> using namespace std; int main() { int numRows; int numColumns; int currentRow; int currentColumn; char currentColumnLetter;...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT