Answer:
char rowList[26] = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
for(char row = 'A';row<rowList[numRows];row++)
{
for(int i = 1;i<=numColumns;i++) {
cout<<row<<i<<" ";
}
}
Explanation:
Replace /* Your solution goes here */ with the above code
and replace #include with #include<iostream>
The line 1 of the above code segment declares a list of all alphabets to represent the rows.
Line 2 and 3 make use of a loop to iterate through rows and column (depending on the input values)
Line 4 prints the resulting row and column values
Take for instance:
numRows = 3
numColumns = 4
What the compiler does is that;
it iterates from A to C --- for rows and
it iterates from 1 to 4 --- for columns
For the first row, it takes alphabet A and digit 1 to 4 to print
A1 A2 A3 A4
Same is applicable to B and C and even if the row is more than 3 as used in this instance