Question

In: Computer Science

SOLVE IN C: Given numRows and numColumns, print a list of allseats in a theater....

SOLVE IN C: 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


Solutions

Expert Solution

#include 

int main() {
   int numRows;
   int numColumns;
   int currentRow;
   int currentColumn;
   char currentColumnLetter;
   
   // Read number of rows
   scanf("%d", &numRows);
   
   // Read number of columns
   scanf("%d", &numColumns);
   
   // Value of currentRow running from 1 to numRows
   for(currentRow=1; currentRow<= numRows; currentRow++)
   {
      // Value of currentColumn running from ascii value from A
      for(currentColumn=65; currentColumn <= 65 + numColumns -1; currentColumn++)
      {
         // Converting integer currentColumn to char
         currentColumnLetter = currentColumn;
         // Printing Value of currentRow and currentColumnLetter
         printf("%d%c ",currentRow,currentColumnLetter);
      }
   }
   
   // Printing new line at the end
   printf("\n");
   
   return 0;
}

Related Solutions

Given numRows and numColumns, print a list of all seats in a theater. Rows are numbered,...
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. Use separate print statements to print the row and column. Ex: numRows = 2 and numColumns = 3 prints: 1A 1B 1C 2A 2B 2C import java.util.Scanner; public class NestedLoops {    public static void main (String [] args) {       Scanner scnr = new Scanner(System.in);      ...
Given numRows and numCols, print a list of all seats in a theater. Rows are numbered,...
Given numRows and numCols, 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 numCols = 3 prints: 1A 1B 1C 2A 2B 2C #include <iostream> using namespace std; int main() {    int numRows = 2;    int numCols = 3;    // Note: You'll need to define more variables    /* Your solution goes...
Given numRows and numColumns, print a list of all seats in a theater. Rows are numbered, columns lettered, as in 1A or 3E.
4.8.2: Nested loops: Print seats. C++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#includeusing namespace std;int main() {int numRows;int numColumns;int currentRow;int currentColumn;char currentColumnLetter;cin >> numRows;cin >> numColumns;/* Your solution goes here */cout << endl;return 0;}
Given numRows and numCols, print a list of all seats in atheater. Rows are numbered,...
Given numRows and numCols, 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 numCols = 3 prints:1A 1B 1C 2A 2B 2C#includeint main(void) {int numRows = 2;int numCols = 3;// Note: You'll need to declare more variables/* Your solution goes here */printf("\n");return 0;}
in java Print a list of seats in a theater. Rows are numbered, columns lettered, as...
in java Print a list of seats in a theater. Rows are numbered, columns lettered, as in 1A or 3E. Print a space after each seat. Create a nested loop to print the following: 1A 1B 1C 1D 3A 3B 3C 3D 5A 5B 5C 5D
I am having a difficult time with this loop. Needs to be in C++. Given numRows...
I am having a difficult time with this loop. Needs to be in C++. 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 #include <iostream> using namespace std; int main() { int numRows; int numColumns; int currentRow; int currentColumn; char currentColumnLetter;...
SOLVE IN C: 6.31 LAB: Print string in reverse Write a program that takes in a...
SOLVE IN C: 6.31 LAB: Print string in reverse Write a program that takes in a line of text as input, and outputs that line of text in reverse. You may assume that each line of text will not exceed 50 characters.The program repeats, ending when the user enters "Quit", "quit", or "q" for the line of text. Ex: If the input is: Hello there Hey quit then the output is: ereht olleH yeH Hint: Use the fgets function to...
Write a C++ function to print any given std::array of a given type to the standard...
Write a C++ function to print any given std::array of a given type to the standard output in the form of {element 0, element 1, element 2, ...}. For example given the double array, d_array = {2.1, 3.4, 5.6, 2.9}, you'd print {2.1, 3.4, 5.6, 2.9} to the output upon executing std::cout << d_array; line of code. Your function mus overload << operator.
(C++) Write a program that reads a list of integers from the keyboard and print out...
(C++) Write a program that reads a list of integers from the keyboard and print out the smallest number entered. For example, if user enters 0 3 -2 5 8 1, it should print out -2. The reading stops when 999 is entered.
Please use C++ and linked list to solve this problem Linked list 1 -> 3 ->...
Please use C++ and linked list to solve this problem Linked list 1 -> 3 -> 4 -> 5-> 6 ->7 replaceNode( 5 , 6) // Replace 5 with 6     result 1 -> 3 -> 4 -> 6 -> 6 ->7 Base code #include <iostream> using namespace std; class Node { public:     int data;     Node *next;     Node(int da = 0, Node *p = NULL) {         this->data = da;         this->next = p;     } };...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT