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]
2 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]2 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
Electricity was seen as a mysterious force and began to creat a stir when people called​
atroni [7]

This isn't related to computers and when you look it up all it comes up with a Stars Wars.

3 0
3 years ago
An IT security threat is anything that might cause serious harm to a computer system.
Blababa [14]

Answer:

True

Explanation:

this is true because a threat can endanger the computer and its system

5 0
2 years ago
The linux and macos program traceroute is known by a slightly different name on windows. it's referred to as ______.
kompoz [17]

The answer is 'tracert'. Tracert or traceroute command is a form of a diagnostic tool which allows you to capture information as the packet is sent from the source and destination providing the route taken and measure of delay across the IP network.

7 0
2 years ago
Annie is a nutritionist. She is conducting seminars about following a healthy diet in various offices. Annie adds a picture of f
Novosadov [1.4K]

I believe in this case you would be using Clip Art.

Smart Art is used on words to make graphics usually.

Graphs are not pictures

Shapes are completely different


8 0
2 years ago
Read 2 more answers
What stage of software development incorporates planning to help make changes in the project plan based of reviews
larisa86 [58]

Answer:

A

Explanation:

8 0
3 years ago
Other questions:
  • Modern database tools support ________________, which entails separating data from the programs that manipulate data.
    14·1 answer
  • True or false An electronic form uses input fields in which the user can enter data from their own computer and then transmit t
    10·1 answer
  • What are the pasting options in Outlook 2016? Check all that apply.
    10·2 answers
  • When users talk about font size,
    10·2 answers
  • If a triathlon is a sport combining three events, what do you think would be the word for a sport combining five events?
    7·1 answer
  • How can you stretch or skew an object in paint
    12·2 answers
  • What is the way to discover requirments for software projects ?
    14·1 answer
  • What is malware? a type of virus that spreads through a network connection a type of virus that targets programs and files any p
    8·1 answer
  • Suppose a large group of people in a room were all born in the same year. Consider the following three algorithms, which are eac
    8·1 answer
  • Why do you want to work from our company?​
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!