Ah, Simple.
We would have to break this up into different pieces of code. The first piece would be:
for(row=0;row<12;row++)
for(col=0;col<6;col++)
initialize[row][col]='*';
The reason we don't print here is because we are going to need a different way and concept to print all 6 columns, but only 2 rows of each. That's why we are going to take another approach. Firstly, lets create another integer called
i. Now, lets make a loop out of it. We will start at 0, and loop until 1; or in this case < 2. Inside this loop we will call on our column loop to loop through all 6 characters, print it and add a space at the end. Each time our first loop passes, we will add a new line. If this makes sense, then this should too:
// Two rows
for(i=0;i<2;i++) {
// Six columns
for(col=0;col<6;col++)
cout << initialize[i][col] << " ";
// Six columns are over; time for new line
cout << endl;
} We add this after our initialization. Hope this helps, and makes sense.
If you have further questions, please feel free to ask.
-
Stack
Overflow