23
votes
Accepted
Error: "make: *** No rule to make target `mario'. Stop."
This is a very common question asked by new students. The make command is used to compile the source code and generate an executable program. While there are complexities to this process (more ...
10
votes
Error: "make: *** No rule to make target `mario'. Stop."
I thought I was in the correct directory, but I wasn't. (I’m a super newbie.)
Execute to show what workspace you’re in “print working directory”:
pwd
Execute to "list":
ls
Execute to “change ...
5
votes
pset1 mario - declaration shadows a local variable
With your usage of int you're creating a new variable.
Example:
int blocks = 5;
{// Just creating a block, similar to a loop
int blocks = 4; //Variable inside the block
printf("%d\n", blocks); /...
5
votes
Accepted
pset1 (mario, more) - problem with unwanted leading spaces
What conclusion can be drawn from these two facts?
This loop for (row = 0; row <= height; row++) will generate height + 1 lines of output (0 through height inclusive)
The first output line (ie row ...
4
votes
What's wrong with this code?
This line causes it: for (spaces = height - rows; spaces <= height; --spaces).
While spaces is less than height, print a space and make spaces smaller. It is an infinite loop.
4
votes
any idea how to fix Mario more comfortable problem "expected output"
check50 is expecting the last # on a line to be followed by the newline. It is complaining about the trailing spaces.
3
votes
So Close on Mario Pyramid
the pseudocode for Mario
for height of pyramid
for (calculate nr. of spaces at height)
print ' '
for (calculate nr. of hashes at height)
print '#'
print a newline
I'd defer ...
3
votes
Accepted
bash: ./mario: Permission denied in Mario problem pset1
A bash permission denied error means that your executable doesn't have the correct permissions. Not sure how that might happen.
First, are you sure that your code is saved as mario.c? And that you ...
3
votes
Accepted
Pset1 Mario- Can't put the user value in to loop!
If it is asking for the number again after building the pyramid, then you have a structure problem. Most likely, you didn't end the loop before starting to build the pyramid, or you've put the whole ...
3
votes
Accepted
cs50 pset1 mario
Let's trace your program.
if you take example height = 5 and you enter into your first for loop, the row = 0 and then you enter into second (first nested) for Loop.
space = 5-0-1 = 4
There will be ...
3
votes
Mario.c : having problems with SCOPE and iteration. Very new to coding
There are a number of issues, some of which I'll point out. Others, I'll leave for you to sort through. Learning to debug is an important skill to learn and this will be a good exercise for you. ;-)
...
3
votes
Accepted
PSET1 Mario More: Same output but still displays error
If I remember correctly, there should be two spaces between the half-pyramids.
If the output is not put into an HTML pre tag, any contiguous whitespace will be compacted into one space, that's why ...
3
votes
did not find EOF Pset 1 mario. expected "##\n", not " ##\n"
In case of a height of zero (which is a valid height), your programme should print zero lines and exit. You probably reject zero as a height and ask again, the tester doesn't expect being prompted for ...
3
votes
Accepted
cs50 pset1 mario math wrong or order?
There's a couple of problems.
First, height is essentially a constant after it is entered by the user. It represents the number of rows to print, and as such, shouldn't be changed by the program. It ...
3
votes
Accepted
Which loop can be replaced for nested for loops for PSET 1 (Mario More Comfortable)?
Hmmm.... Good question for new programmers!
The style guide is right, more than 2 or 3 nested for loops should raise red flags, especially if they are based on the same controlling variable as in ...
3
votes
Accepted
Pset1: Problem: expected “##\n”, not “ ##\n”
Your own question hides the answer, carefully observe the difference:
"##\n" " ##\n"
There is a space that should not be there, the hashtag must be perfectly aligned to the left. Your program is ...
3
votes
Accepted
Pset 1 - Mario pyramid trouble with spaces/dots
The problem is your nesting of loops. For each row, you print height-row+1 dots/spaces and one hash, and this whole thing row+1 times.
Place your two inner loops on the same level, one after the ...
3
votes
Accepted
tests give weird results despite (seemingly) correct output
This expected "# #\n", not " # # \n" is telling you that there is an extra space in front and an extra space at the end.
There should be nothing printed after the final # on a line, so that part ...
3
votes
Accepted
Doing mario.c less comfortable one step at a time
Your analysis is correct, as far as it goes. The rest is pretty simple and is a basic demonstration of nested for loops. To make it clear, let's display the full loop correctly, since the curly ...
3
votes
Accepted
cs50 problem set 1 mario. check50 command returns error: 'You seem to be missing these required files: mario.c'
You MUST be in the same directory as the source code to run check50 and submit50. It doesn't work if you're not. The parameter isn't about where the code is located, it's about which tests to run.
...
3
votes
Do - While loop
you want to keep asking the user about height if n is smaller than 1 or larger than 8 right ? check your code, the way you're writing it ,the program is gonna keep asking for height as long as n is ...
3
votes
pset1 (mario, more) - problem with unwanted leading spaces
You want to repeat your outer loop one less time and print one less space each time. To do this you simply need to change your <= operator in your outer loop and your first space printing loop a &...
2
votes
Accepted
PS1 Mario, prints out nicely but check 50 rejects
When given 3 as input, your program prints out:
(I will replace spaces with 0s for simplicity, and # with "hashtag" because stack has some formatting thing with hashes.)
00hastag
0hastaghastag
...
2
votes
Specifics of grading, and indivudality in coding
The psets are graded by the same check50 automated grading program. Because there are thousands of students taking this class online, this is the only way to do this. CS50x staff do not look at the ...
2
votes
Accepted
what exactly is wrong in my output?
looks like you're using a GOTO statement do avoid that if you can
my suggestion is to use a do while loop instand using a GOTO statement.
you refer this code snippet but don't copy this code as it (...
2
votes
what exactly is wrong in my output?
can't say anything without looking at code so please include code
but while looking at that sandbox link looks like you don't returning values that expected by check50
like this if program is given ...
2
votes
SUCCESS!!!!!!!!!!!!!!!!!!!!!!!!!! mario.c, Pset1 !
There should be no semicolon after int main (void) on line 14.
On line 26, you are missing a closing parenthesis at the end.
On line 22, there should be no equal sign.
2
votes
How am I supposed to read these error messages?
The smiley is basically a true or false statement for the code next to it.
If it says:
:( integer i is 3
That means integer I is supposed to be 3, but in your program, it is not. The code after the ...
2
votes
Accepted
hacker1 mario: output appear correct, but won't pass check50
Looking at your output, it appears that you have an extraneous leading space on each line. For instance, the first line should be #**#\n, not *#**#\n (spaces replaced with * for clarity)
If this ...
2
votes
Accepted
PSET 1 Mario pyramid ALWAYS prints upside down
On the outer loop you are correctly incrementing line by one in
every iteration. But on the first inner loop, you initialize s to
line and then, instead of incrementing s you are incrementing
line ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
mario × 489pset1 × 359
check50 × 35
cs50x × 31
c × 24
mario.less × 23
pyramid × 21
pset6 × 19
error × 15
less × 15
python × 14
for-loop × 10
spaces × 10
lesscomfortable × 8
compilation-error × 7
hashes × 7
help × 6
loop × 6
cs50x2019 × 6
hacker1 × 6
morecomfortable × 6
do-while × 6
mario.more × 6
cs50-ide × 5
cs50-pset1 × 5