3
votes
Mario pyramid works, but check50 not buying it
This is a fairly common misinterpretation of the spec. The pyramid should print out so that there are no leading spaces on the last line, no matter how high the pyramid is.
This code prints too many ...
2
votes
Accepted
mario (less) getting 53% score
Sorry to burst your bubble, but this code doesn't work correctly. It prints a left-justified pyramid. The pyramid is supposed to be right-justified. It prints spaces after the hash marks. They ...
2
votes
MarioLess - declaration shadows a local variable error
Look at this code:
int h = get_positive_int("What height do you want: ");
//print the pyramid
for (int h = 0; h < n; h++)
It declares h (as an int) twice. Change one of them.
Also, n hasn't ...
2
votes
Accepted
Struggling with Mario (less comfortable) loop conditions
Nesting loops to a level of three makes little sense for iterating 2D structures.
I think you have to move your innermost loop out, directly in front of the loop it's currently in, so that you have ...
2
votes
Accepted
Error: use of undeclared identifier 'j'
You did use an undeclared identifier j in the second for loop. It isn't created until and only inside the following 3rd for loop.
The compiler never lies. It might mislead on occasion, but it never ...
2
votes
Cannot compile Mario (less comfortable) in PSET 1
if you successfully ran "make mario", why are you running clang? The make command is doing all the compiling and linking for you.
Without the correct compiler flags in the command, it won't ...
2
votes
Stumped on PSET 1 Mario Less Comfortable
Looks like you have an extra for loop there, which will cause the entire thing to loop l times when that's probably not what you intended.
2
votes
Accepted
Mario less, struggling with nested FOR loop
Don't stress yourself out too much with trying to understand everything, even after reading up on it--sometimes things only "click" after your brain stops thinking about it. Let's take a ...
2
votes
Accepted
A problem with my code in PSET 1 Mario less comfortable
The problem is in your nested for loop. It prints a space all the way up until i + j <= n - 1. Once this is no longer true, your program exits the loop.
Let's look at this in a little more detail:
...
2
votes
Can anyone please help with mario less comfortable?
Simply put, the code doesn't compile, so none of the other tests can be done by check50.
Did you actually compile your code and run it first, or did you go straight to check50? The code needs to ...
2
votes
Accepted
pset1 mario - hashes output
Here's a hint. How many hashes in the first row? The second row? The third row? Does the number of hashes in any given row have any relationship to the height of the pyramid? Or is the number of ...
1
vote
PSet 1 Mario Less - cube instead of expected stair
The inner for loops are all based on height, so they're going to do exactly the same thing on every pass of the outer loop. Every row will look like every other row, so you get a cube.
Maybe they ...
1
vote
pset1 not printing hashes for mario
Please try to understand the pset questions, once you do take small steps and write down problem requirements in word and then transform those into the code exactly as per the specifications. Follow ...
1
vote
Problem with check50's result for pset1 mario less
The problem is the leading spaces on each line. This code will print 6 leading spaces on the first line no matter what. This is incorrect.
You could say that your code is simply printing the top h ...
1
vote
Accepted
how can i get for it reprompt if the user types negative integer or number more 8 . my code does the oppoiste of what i want it to do how do reprompt
Think negatively!
Look at the test that the code is doing:
while(n <= 8 && n >= 1 )
This checks that n is in the range that is valid. You want the loop to repeat if it isn't in the ...
1
vote
Stumped on PSET 1 Mario Less Comfortable
in your code check the first for loop, why is the counter decreasing ?
why do you need 4 for loops?
to create the right aligned pyramid you need only 3 for loops.
external loop, to count from the ...
1
vote
Pset1 - Mario (less) - White Space
Why are you printing a newline before your pyramid?
Remember the spec showed:
~/pset1/mario $ ./mario
Height: 4
#
##
###
####
check50 will be looking for that.
1
vote
Accepted
Struggling to align pyramid and check for extra spaces at the end of each line in pset6 mario.py less
Don't make things complicated.
for x in range (height):
print((height-x - 1)*' ' + (x+1)*'#')
1
vote
Accepted
how do i write pesudocode.txt for Mario? (less comfortable)
You make a new file by clicking the green plus sign at the top, next to where it says the name of the file you are currently on. On your keyboard, then do command shift S. It will give you options for ...
1
vote
are we supposed to use the set from hello.c to begin with Mario (less comfortable) or do we need a new terminal and file?
It's a new program. Start with a new file. You're done with hello.c, but feel free to look at it for any ideas on how to do anything you've done in the past.
These instructions are guiding you through ...
1
vote
Accepted
are we supposed to use the set from hello.c to begin with Mario (less comfortable) or do we need a new terminal and file?
You don't have to create a new terminal window, but you should only start mario if you're finished with hello. If you're in the hello directory, on your terminal, execute:
cd,
cd pset1,
mkdir mario,
...
1
vote
Accepted
No rule to make target 'mario'. Stuck on where I am going wrong. Cannot compile existing file
The mario file exists in the mario directory, but you are not executing the command in the same directory. You're in the root directory, two directories above mario.c. You need to be in ~/pset1/...
1
vote
Accepted
pset6/less/Mario passing all checks, but score at 90%
From the CS50 syllabus:
Problems are evaluated along axes of correctness (as determined by a
program called check50) and style (as determined by a program called
style50), with scores ...
1
vote
Accepted
pset 6 mario, I'm getting wrong ouput
Your code is badly formatted, so it is not possible to reproduce your problem easily. Luckily I know Mario. The range() function starts from zero by default so there are extra lines the solution is to ...
1
vote
Accepted
PSet1: Mario - Less Comfortable (Too many periods)
for (space = 0; space <= height - row; space++) runs height - row + 1 times (+1 for having <= instead of <). For the first row, you should have height - 1 spaces, but you have height + 1. Fix ...
1
vote
Accepted
Pset 1 mario (less comfortable)
I don't think you've quite grasped the assignment. The code is to print out the left side of the pyramid so that it is right-justified. That means that it is supposed to have leading spaces before ...
1
vote
Accepted
It doesn't work?!!! (Mario less)
The errors are self explanatory.
The code accepts 0 as a valid input, it should reject it.
In all the pyramids that the code prints, the first line has two #'s. There should be only one.
Is it ...
1
vote
Accepted
How to print out hashes in mario(less comfortable)? (2019)
You assign the height to variable i, and on the next line you overwrite it with 0, throwing away the user input. Make the row counter a different variable, and name your variables according to their ...
1
vote
Accepted
Errors while check50 in Pset1 mario less, expecting suggestions
Let's have a look at one of those error messages:
:( handles a height of 2 correctly expected " ##\n###\n", not "##\n"
This means that for a height of 2, the test expected to get:
##
###
while ...
1
vote
I get an error like make: ***No rule to make target 'mario how to resolve it.'
cd (change directory) into the directory where mario.c is located (type ls and it should show up), then enter make mario.
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
mario.less × 54pset1 × 28
mario × 23
cs50x × 9
pyramid × 5
pset6 × 4
error × 4
cs50-ide × 3
help × 3
cs50x2019 × 3
cs50-pset1 × 3
code × 3
problem-set-1 × 3
c × 2
getint × 2
hashes × 2
check50 × 1
python × 1
fails-check50-but-works × 1
for-loop × 1
week1 × 1
ide × 1
variables × 1
style50 × 1
lesscomfortable × 1