1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
KengaRu [80]
3 years ago
14

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

Computers and Technology
1 answer:
yawa3891 [41]3 years ago
6 0

Answer:

Step by step explanation along with code and output is provided below.

Explanation:

// the outer loop is for printing digits starting from 1 to numRows

// the inner loop is for printing letters starting from 'A' to numCols

//  char cols = 'A';   should not be inside inner loop or outside outer loop, in both these cases char either repeats itself or continues in a sequence. Therefore it must be inside of outer loop

//  int rows = 1;  ensures that row starts at 1

#include <iostream>

using namespace std;

int main()

{

int numRows;

int numCols;

int rows = 1;

cout <<"Enter number of Rows"<<endl;

cin>>numRows;

cout <<"Enter number of Columns"<<endl;

cin>>numCols;

cout<<"Seats in the theater are:"<<endl;

for(int i = 0; i < numRows; i++)

{

  char cols = 'A';  

 for(int j = 0; j < numCols; j++)

 {

  cout <<rows << cols << " ";

  cols= cols + 1;

 }

 rows= rows + 1;

}

  return 0;

}

Output:

When Rows = 2 and Columns = 3

Enter number of Rows

2

Enter number of Columns

3

Seats in the theater are:

1A 1B 1C 2A 2B 2C

When Rows = 4 and Columns = 5

Enter number of Rows

4

Enter number of Columns

5

Seats in the theater are:

1A 1B 1C 1D 1E 2A 2B 2C 2D 2E 3A 3B 3C 3D 3E 4A 4B 4C 4D 4E

Hence program is working correctly for any number of rows and columns

You might be interested in
In a _____ network, each device on the network is attached to a central server. If the server fails, then the other devices will
Tresset [83]
Answer: star

Explanation: A star network topology is an implementation of a spoke–hub distribution paradigm in computer networks. In a star network, every host is connected to a central hub. In its simplest form, one central hub acts as a conduit to transmit messages. The star network is one of the most common computer network topologies.
5 0
3 years ago
What piece of equipment is NOT a tool that would be considered appropriate equipment for on-site visits? a. multimeter b. flashl
Anton [14]

The oscilloscope is NOT a tool that would be considered appropriate equipment for on-site visits. The oscilloscope is an electronic test instrument used to observe observation constantly varying signals. This instruments is used in laboratories, and not on-site visits.

All other instruments are moveable and can be used on-site.


3 0
3 years ago
When completing an application what color ink do you use
tankabanditka [31]

Black or blue pen would be appropriate.

5 0
3 years ago
Read 2 more answers
HELP ASAP
joja [24]
Dkydylfiyfuofoyfuofou
7 0
2 years ago
True or False? Any edition or version of Windows can join a domain.
Veseljchak [2.6K]

Answer: TRUE! 100%

If I was helpful i would to be rated brainliest please thank you!

Explanation:

8 0
2 years ago
Other questions:
  • Which loan type requires you to make loan payments while you’re attending school?
    10·1 answer
  • How can i put this sign in my keybord?<br><br> :::::<br> ^<br> Here is the sign
    8·1 answer
  • To reduce inflation, the Federal Reserve _____ the money supply. This action also causes the economy to shrink.
    13·2 answers
  • What is the difference between an electronic notebook and electronic flash cards?
    8·1 answer
  • Which documents might an employer expect to find in a career portfolio?
    15·2 answers
  • There are many apps that help find you cheaper gas. If the cost of a gallon of regular gas is $3 at one station and $3.50 at ano
    15·1 answer
  • Se numeşte permutare a unei mulţimi finite orice rearanjare a tuturor elementelor acelei mulţimi.
    14·1 answer
  • Como se llaman las herramientas y maquinas pque utilizan para hacer cosas artesanales
    10·1 answer
  • A binary search algorithm ____________ an ordered list in<br> half to find an item.
    13·1 answer
  • Unscramble the given word and identify the correct statement about it. ATTEPLSR
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!