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 declare more variables
/* Your solution goes here */
cout << endl;
return 0;
}
//do it on c++ please ...output must excute in one line
#include <iostream>
using namespace std;
int main() {
int numRows=2; //for number of rows ,select a variable
int numCol=3; //for number of columns,select a variable
int i,j; //take two variable for loop,one for printing row and
other for colmn
char k; //take a char variable as we have to print A B C...
for(i=1;i<=numRows;i++)
{
k='A'; //initialize it with A
for(j=1;j<=numCol;j++)
{
cout<<i<<k<<" " ; // " " is used for giving
space
k=k+1; //after incrementing char it will increment char value only
i.e A will become B and so on.
}
}
return 0;
}
OUTPUT:
1A 1B 1C 2A 2B 2C
Get Answers For Free
Most questions answered within 1 hours.