Print Rectangle

closed account (SwADGNh0)
I am to write a program that takes two lists of 5 positive integers each, and place them in two arrays called "rowList" and "columnList". Afterwards, generates 5 rectangles of asterisks, each with dimensions taken from the previous two arrays provided. The 1st elements of "rowList" and "columnList" would generate the first rectangle, the 2nd elements of "rowList" and "columnList" would generate the second rectangle, and so on.
The program must implement and use a function called "printRectangle", which takes two input parameters (one for row numbers, and one for column numbers),and generates a rectangle with the dimension specified by the parameters (row and column).

Can someone explain how to program the part for rectangles where it picks up one number from rows and one from columns and create a rectangle accordingly?
In my opinion, questions like this are better suited for the Beginners Forum.

I am going to use underscores as a way of saying fill-in-the-blank
1
2
3
____ printRectangle(___row___, ___column___) {
    _____ //probably will be multiple lines, I'm picturing 5-7 ish
}


Somewhere else in your program (maybe main?)
1
2
3
4
5
6
int rowList[5];
int columnList[5];
........
for(int index = 0; index < 5; index++) {
    printRectangle(rowList[___], columnList[___]);
}


Hopefully, this is a good start for you.
Topic archived. No new replies allowed.