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
What are the pros and cons of using ICT​
Setler79 [48]

Answer:

Communication - Speed / time – money can be saved because it's much quicker to move information around. ...

Globalization - Video conferencing saves money on flights and accommodation. ...

Cost effectiveness - It feels free to send an email (although it isn't); it's without doubt cheaper than phone calls.

Explanation:

4 0
2 years ago
how can i stop this stupid thing from sending me emails because my school decides to not give you a block option
tekilochka [14]

Answer:

If it on g mail you go to the spam box and then press the spammers to account and then press block and then you will block them.

5 0
3 years ago
Read 2 more answers
So I bought a mechanical keyboard with cherry mx red switches. you're called "linear and silent" they are linear but they aren't
Gnom [1K]

Answer:

If the keys were silent in the review, it could have been one of two things. The first thing being, the microphone just wasn't picking up the audio as good and the second being, you could have just got scammed. Would you mind telling me the model of your keyboard so I can do some research. Cherry mx switches are loud because they bottom out on the keyboard. The actual switch itself is very quite. All linear means is that they keystroke is consistent and smooth rather than a Tactile switch which has a bum in the middle of its' stroke. In advertisement, they will lightly press they switch and that catches your attention when in reality whatever you are doing gaming or typing you will be slamming your keys down with a considerable amount of force. If you want a quiter keyboard I would pick a low profile keyboard which means that they keystroke is not as long as a mechanical keyboard which also means that the noise from the key hitting the keyboard will be a lot less loud.

Explanation:

Hopefully that kinda answers your questions.

7 0
3 years ago
"What router feature provides basic security by mapping internal private IP addresses to public external IP addresses, essential
Drupady [299]

Answer:

i think phone

hope this helps u stay safe

Explanation:

4 0
3 years ago
How many hours did it take supercomputer to calculate pi?
dybincka [34]
35 hours to be exact
3 0
3 years ago
Other questions:
  • What is an example of asynchronous communication
    7·1 answer
  • Which of the following would a high school graduate interested in the performing arts most likely do after graduation?
    10·1 answer
  • A biologic reaction is produced by 4 Gyt of a test radiation. It takes 16 Gyt of 250-kVp x-rays to produce the same biologic rea
    11·1 answer
  • A new product was introduced in 2003, which functions as both an identification device and a medium of communication. It uses in
    8·1 answer
  • What is a slide master ?
    8·2 answers
  • Which are examples of non-linear presentations? Choose all that apply.
    11·1 answer
  • What is the difference between "What I ought to do?" and "What kind of person should I be"?
    12·1 answer
  • REPORT THIS USER. HE'S SHOWING HIS YK WHAT TO EVERYONE INCLUDING ME. HIS ACCOUNT PROFILE IS IN THE PICTURE BELOW
    14·1 answer
  • My phone takes forever to load the ads, does anyone else have this problem? Is there a way to fix it? I’ve tried getting another
    12·2 answers
  • What kinds of new input devices do you think might be invented in 10, 20, or 50 years? How might those devices change the world?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!