Ok, I need help and bad. I'm like freaking out because normally I can figure things out, but I'm going insane. I have no idea what I'm supposed to do/where to start. I am NOT looking for the direct answer because that will not help me with future projects, but rather I am looking for someone to walk me through what I am supposed to do or at least give me some really detailed starting tips.
So far I have:
int row;
int num;
for(row=4; row>=0; row--){
for (num=row; num>0; num--){
printf("$");}
printf("5\n");
}
but this only creates part of pattern B and I'm still so confused. I'm still not even completely sure about what I just did.
How am I supposed to create these patterns?? It just boggles my mind like nothing I've ever done before.
If someone can help me out then it would be appreciated to the fullest. Like I said though, some detailed explanations and steps are preferred rather than the flat-out answer.
Here's what I'm supposed to be doing:
The Task
The program you write will deal with printing patterns. You will plot a filled-in box using an ascii character and also the number corresponding to the size of the box. The size of the box will be entered by the user and will be both the number of rows and the number of columns in the box. You will print one of three patterns depending on the menu option the user selects. For a box of size 5 and the character '$', the following pattern options could be produced:
A B C
5$$$$ $$$$5 $$$$$
$5$$$ $$$5$ 5$$$$
$$5$$ $$5$$ 55$$$
$$$5$ $5$$$ 555$$
$$$$5 5$$$$ 5555$
You will ask the user to input the size of the box and also the character you should use to display the pattern.
For the size, you should only allow the user to enter a number between 2 and 9, inclusive. So, 1, for example, is not a valid size. You should error check the input and allow the user to keep entering numbers until he/she enters a number in the correct range.
So far I have:
int row;
int num;
for(row=4; row>=0; row--){
for (num=row; num>0; num--){
printf("$");}
printf("5\n");
}
but this only creates part of pattern B and I'm still so confused. I'm still not even completely sure about what I just did.
How am I supposed to create these patterns?? It just boggles my mind like nothing I've ever done before.
If someone can help me out then it would be appreciated to the fullest. Like I said though, some detailed explanations and steps are preferred rather than the flat-out answer.
Here's what I'm supposed to be doing:
The Task
The program you write will deal with printing patterns. You will plot a filled-in box using an ascii character and also the number corresponding to the size of the box. The size of the box will be entered by the user and will be both the number of rows and the number of columns in the box. You will print one of three patterns depending on the menu option the user selects. For a box of size 5 and the character '$', the following pattern options could be produced:
A B C
5$$$$ $$$$5 $$$$$
$5$$$ $$$5$ 5$$$$
$$5$$ $$5$$ 55$$$
$$$5$ $5$$$ 555$$
$$$$5 5$$$$ 5555$
You will ask the user to input the size of the box and also the character you should use to display the pattern.
For the size, you should only allow the user to enter a number between 2 and 9, inclusive. So, 1, for example, is not a valid size. You should error check the input and allow the user to keep entering numbers until he/she enters a number in the correct range.
Comment