Now, modify mario.c in such a way that it prompts the user for the pyramid’s height, storing their input in a variable, re-prompting the user again and again as needed if their input is not a positive integer between 1 and 8, inclusive. Open the file called mario.c inside of your mario directory. Whatever your pseudocode, let’s first write only the C code that prompts (and re-prompts, as needed) the user for input. It’s okay to edit your own after seeing this pseudocode here, but don’t simply copy/paste ours into your own! Prompting for Input On iteration i, print i hashes and then a newline.If height is less than 1 or greater than 8 (or not an integer at all), go back one step.There’s more than one way to do this, so here’s just one! Odds are your pseudocode will use (or imply using!) one or more functions, conditionals, Boolean expressions, loops, and/or variables. Recall how we wrote pseudocode for finding someone in a phone book. There’s no one right way to write pseudocode, but short English sentences suffice. Write in pseudocode.txt some pseudocode that implements this program, even if not (yet!) sure how to write it in code. To open the file called pseudocode.txt inside that directory. You should find that its “prompt” resembles the below. Start by clicking inside your terminal window, then execute cd by itself. Clubhouse Facebook GitHub Instagram LinkedIn ORCID Quora Reddit TikTok Telegram Twitter This is CS50 CS50’s Introduction to Computer Scienceĭavid J.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |