Skip to content

danigmartin/Mario

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Mario

This is the Problem Set week 1 of CS50x course 2019

Toward the beginning of World 1-1 in Nintendo’s Super Mario Brothers, Mario must hop over adjacent pyramids of blocks, per the below.

Let’s recreate those pyramids in C, albeit in text, using hashes (#) for bricks, a la the below.

   #  #
  ##  ##
 ###  ###
####  ####

The program we’ll write will be called mario. And let’s allow the user to decide just how tall the pyramids should be by first prompting them for a positive integer between, say, 1 and 8, inclusive.

Here’s how the program might work if the user inputs 8 when prompted:

$ ./mario

      Height: 8

       #  #
      ##  ##
     ###  ###
    ####  ####
   #####  #####
  ######  ######
 #######  #######
########  ########

If the user doesn’t, in fact, input a positive integer between 1 and 8, inclusive, when prompted, the program should re-prompt the user until they cooperate:

$ ./mario

 Height: -1
 Height: 0
 Height: 42
 Height: 50
 Height: 4

   #  #
  ##  ##
 ###  ###
####  ####

About

This is the Problem Set week 1 of CS50x course 2019

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages