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 file format is best for photo editing? Select one: a. JPG b. RAW c. DOC d. RTF
timama [110]

Answer:

i use JPG

Explanation:

7 0
3 years ago
Read 2 more answers
Zack is working on an assignment at school. He wants to save his work so he can take it home and complete it on his home compute
ser-zykov [4K]

Answer:

USB DRIVE

Explanation:

If I was zack i would use a usb drive, since it is portable and small and would fit his school work

3 0
3 years ago
It is important to keep a copy of your written plan and safety records off-site. A) True B) False
mel-nik [20]

The answer for the question is true

3 0
3 years ago
Read 2 more answers
The most infuential programming language is ______.
Oksi-84 [34.3K]

Answer: the most influential programming language is Java script

Explanation:

3 0
4 years ago
A "credit score" is a three-digit number which rates how much a company likes you personally. True. False.
marin [14]
False your credit score is a gauge of how good your credit is

can i be brainliest?
6 0
3 years ago
Read 2 more answers
Other questions:
  • What type of mitigation provision is utilized when redundant communications links are installed?
    8·1 answer
  • If you combine two cells into one, what action are you performing?
    12·2 answers
  • Given the following: int funcOne(int n) { n *= 2; return n; } int funcTwo(int &amp;n) { n *= 10; return n; } What will the follo
    15·1 answer
  • System.out.print();
    10·1 answer
  • What is the purpose of a router
    13·2 answers
  • Requirements description:
    6·1 answer
  • Help<br> pls need quickly
    9·1 answer
  • WILL GIVE A BRAINLIEST!!! PLS HELP!!!
    5·1 answer
  • What is the difference between cyberbullying and bullying.
    5·2 answers
  • Which type of malware prevents you from accessing files stored on your computer?
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!