I have completed Mario.c and now I want to some advance skill on mario.c Like: I want to ask user that how many pyramid they want to have because by default it will only show one pyramid and different height as per user requirement. Need some cooperation. Thanks
2 Answers
What you want to do, make something more advanced, is described in the hacker edition of pset1 where you have to print two pyramids, as follows:
# #
## ##
### ###
#### ####
Try it out here: https://cdn.cs50.net/2015/x/psets/1/hacker1/hacker1.html
-
-
What do you mean "find the source codes"? You are supposed to write the program.– ChrisGJul 20, 2015 at 9:03
-
I have tried simple mario.c but when I am trying to do two pyramids mario then it gives me error Jul 20, 2015 at 11:07
-
Create a new question and post the code you have written and the problem you are facing exactly.– ChrisGJul 20, 2015 at 15:35
Sounds like you need to first ask how many pyramids the user wants (probably as a command line argument) and use that in a loop asking for height of each pyramid.
Next question would be whether you intend to draw the pyramids in a line or stacked in a column. Either way, nested loops combined with the original mario.c drawing logic should handle it. You would just need to add the appropriate number of spaces to separate horizontally arranged pyramids or blank lines for vertically separated pyramids.