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 is a system analyst?
Novosadov [1.4K]

Answer:

A system analyst is a profession where someone researches and explores about different technological systems.

Explanation:

Hope this helps!

4 0
3 years ago
Disadvantage do you think one can have if he or she does use electronic media
Dima020 [189]
- discontinuity
- dependence on the electric power
and more
6 0
3 years ago
If $350 is the profit of an initial investment of $1000.00, what is the percentage profit?​
umka2103 [35]

Answer:

35%

Explanation:

1000x=350

x=350/1000

x=0.35

35%

6 0
3 years ago
Read 2 more answers
_______For the C programming language, files containing the code you write are named with a file extension of .g. (T/F)
erastovalidia [21]

Answer:

False.

Explanation:

In C programming language the file which containing the code that we are writing the code is have the file extension .c and for c++ it is .cpp.  C programming language is a general purpose procedural computer programming language.

.g file extension is for data chart file format used by APPLAUSE database development software.

Hence the answer to this question is false.

4 0
3 years ago
By default, client DHCPv6 messages are sent using _____ scope. (Points : 3) the anycast address
coldgirl [10]

Answer: Router's prefix

Explanation: DHCPv6 (Dynamic host configuration protocol version 6) is the protocol used for an IPv6(Internet protocol version 6) network's host,prefixes,address and other such configurations.The prefix is used for sending the messages of DHCPv6 in the default situation.

In default situation the prefix acts as the cluster of the IP address and thus sends the the message to the destination using the address. Other options are incorrect because anycast address, local link and  FF02::0A does not transmit the message in the default situation.Thus the correct option is router's prefix.

7 0
3 years ago
Other questions:
  • Which of the following assignment statements contains a LOGICAL error? I multiply two numbers when they need to be added I write
    9·1 answer
  • Which organizational pattern would probably be most effective for arranging the main points of a speech with the specific purpos
    15·1 answer
  • The encapsulation unit on the presentation layer of the osi model is
    10·1 answer
  • What is meaning of reboot
    7·2 answers
  • Adele’s mother owns a Daycare and she wants to learn all about this business, to help her mom and own it one day. Which CTSO sho
    9·1 answer
  • What is the Matlab command to create a vector of the even whole numbers between 29 and 73?
    11·1 answer
  • Which part of project management involves determining the overall work? Breakdown Incomes Scope Time
    15·1 answer
  • State all the generations of computers.
    10·2 answers
  • What is the output of the C++ codeabove?
    14·1 answer
  • 1.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!