Not Understanding The Question

I have a assignment and got confused on this problem any tip how to solve this


Call a method named printCol that will print the contents of the col number referenced above, one item per line. Do this using a for or a while loop- and any other structures needed.

Last edited on
Any tip plz
Plz someone give me tip
Can i see the whole assignment? From your specs given it seems like it's just
1
2
3
while(counter < aNumber){
    cout << colNum << endl;
}
Last edited on
Question 2:

1.  In the main method

a)  Declare and initialize a two-D array of integers containing 8 rows and 8 columns. The diagonal cells that run from upper left to lower right contain the integer 1. The other cells contain 0.

b)  Prompt the user to enter a row number and a column number - these will be used below.

c)  Populate the array as described above using either a for loop or a while loop.

 2.  Call a method named printArray that will print the contents of the array,  8 numbers per line

 3.  Call a method named printCol that will print the contents of the col number referenced above, one item per line. Do this using a for or a while loop- and any other structures needed.

 4.  Call a method named printRow that will print the contents of the row number referenced above, all on one line with a space between each. Do this using a for or a while loop - and any other structures needed.

 5.  Call a method named printDiagonal that will print the numbers on the diagonal, all on the same line, with a space between. Do this using a for or a while loop - and any other structures needed.
In the main() you have a variable for column number, whose value you get from the user. You also have a "two-D array" and some other variables. Then, in main(), you do call a function whose name is "printCol".

The function must take some arguments. What information does one need to print a column of an array?

Have you already written a "printArray" or "printRow"?
i have done the problem no 1 and 2 but not understanding the problem no 3 , 4 ;
So i'm guessing from your specs that if the user wants to print column 3 the output should be
1
2
3
4
5
6
7
8
1
2
3
4
5
6
7
8

and the row should output
1 2 3 4 5 6 7 8

for(int index=0; index<8; index++)
This for loop should suffice for the printCol and printRow
Last edited on
@personxdi ty for replaying to my problem
Topic archived. No new replies allowed.