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
Generally speaking, mobile sites are good for acquiring new customers and inspiring new relationships while mobile apps are good
Zigmanuir [339]

Answer:

true

Explanation:

this may be for example, for mobile sites, everyone has a chance is run into it and fall in love with what the site has to offer that acquiring new costomers and inspiring new relationships from the large amount of traffic in such sites but mobiles apps are discovered, you cannot download an app if you dont know anything about.

4 0
3 years ago
Which function of a word processing program enables you to apply a preset formatting
IRISSAK [1]

Answer:

Styles Function

Explanation:

If you have a document that needs consistent formatting, we can use styles in Microsoft Word. It gets tedious when we manually apply formatting on every single page of our document. This is why it is important to apply styles because it is easier and more convenient. The styles option is found on the Home Tab.

8 0
3 years ago
16 to 19 year old drivers are how many more times likely to crash? 1.7,2.7,0.7 ,3.7
ElenaW [278]
16 to 19 year olds are 2.7 times more likely to crash. 
8 0
3 years ago
Read 2 more answers
Create and test a user-defined function named ufnFullName that combines the values of the two parameters named FirstName and Las
8090 [49]

Answer:

   public static String ufnFullName(String Fname, String Lname){

       String FullName = Fname+" "+Lname;

       return  FullName;

   }

Explanation:

Using Java programming language, the function is created to accept two String parameters (Fname and Lname)

These are concatenated into a new String FullName and returned by the function

See below a complete code that prompts users to enter value for first and last names then calls this method to display the full name

<em>import java.util.Scanner;</em>

<em>public class FullName {</em>

<em>    public static void main(String[] args) {</em>

<em>        System.out.println("Enter First Name");</em>

<em>        Scanner in = new Scanner(System.in);</em>

<em>        String Fname = in.next();</em>

<em>        System.out.println("Enter Last Name");</em>

<em>        String Lname = in.next();</em>

<em />

<em>        System.out.println("Your Full Name is "+ufnFullName(Fname,Lname));</em>

<em>    }</em>

<em>    public static String ufnFullName(String Fname, String Lname){</em>

<em>        String FullName = Fname+" "+Lname;</em>

<em>        return  FullName;</em>

<em>    }</em>

<em>}</em>

8 0
3 years ago
In Microsoft Windows, which of the following typically happens by default when a file is "double-clicked"
Elenna [48]
Depending on the type of file, it normally runs or opens.
4 0
3 years ago
Read 2 more answers
Other questions:
  • Processing is handled by the computer’s central processing unit (cpu).​ <br> a. True <br> b. False
    6·1 answer
  • Which of the following is something that scientists often seek by using computer models and simulations?
    8·2 answers
  • A tornado may be approaching if you observe which of the following?
    15·1 answer
  • Cryptcat is a Linux distribution that includes hundreds of security and hacking tools, including Nessus and Metasploit. It can p
    11·1 answer
  • What is the awnser ?
    11·1 answer
  • Which graphic file format is used for commercial purposes.
    10·1 answer
  • Neview of related literature happens in two wayo (1) Traditional and
    6·1 answer
  • What is the benefit of hosting a website on a personali
    6·1 answer
  • What happens on your screen when you click on the eyedropper tool in Scratch? The background of your scene will become transpare
    7·1 answer
  • In a relational database, information is organized into tables in which each row represents a(n ) ________. Group of answer choi
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!