11
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
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
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
Error: "make: *** No rule to make target `mario'. Stop."
I had the same error and turns out I was in the root directory. You need to be in the mario-more directory to execute the make mario command. Just check if you $ sign has mario-more/ prefix.
If not ...
2
votes
2
votes
Pset1 Question Mario
See anything wrong here?
for (rows = 0; height <= rows; rows++)
If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)
2
votes
Accepted
Problem with printing the # symbols on mario.c
Your hash loop prints height+1 hashes every time (one per iteration of the inner loop, iterated height+1 times). This does not change over the several rows, as all the variables used have the same ...
2
votes
Accepted
pset1: mario - error msg
An easy issue to fix. The syntax of your for loop is incorrect. A for loop statement has three clauses. The clauses are separated by semicolons as in:
for( x = 0; x < 10; x++) {...}
Your ...
2
votes
pset1: mario - error msg
There are just some syntax errors. Remember mate the general format of for loop is:
for(initialize ; condition ; increment/decrement)
so in for loop you've used comma(,) instead of ...
2
votes
pset1 mario less comfortable
I don't want to spoiler your, so I try to give you a hint. If this is not helping you I can get more concrete.
You know that the peak of mario's hill is 1 hash wide, so you want to print 1 hash in ...
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 ...
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
Help with Mario - expected expression/identifier
You have to declare h before your loop, and not within, otherwise the condition cannot see it. Also, looks like your curly braces are not right. The while surely should be inside your main function, ...
2
votes
do while mistake , please give right code
Your problem is a scope issue.
The way you declare n, it ceases to exist after you leave the loop's body. Which means when you enter the while(n<=0), it no longer is.
To prevent this, place a int ...
2
votes
Accepted
cs50 wrong analysis of mario/more
You should not have spaces after your last hash of the line. Made this mistake myself, trying to make it symmetric I added the same spaces as on the front (you seem to even add space(s) for height 1, ...
2
votes
i am unable to submit my work in pset1 of marioless. It shows me a comment in yellow which says invalid slug.What should I do?
An invalid slug error means that the parameter following check50 or submit50 is incorrect. Go back to the problem spec and see what it's supposed to look like. I'll guess a missing slash or ...
2
votes
mario_error: expected identifier or '('
No worries, it's a common mistake for new programmers. A semicolon ends a line of code or a code block. In this case, you have placed a semicolon after the main signature code:
int main(void);
By ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
mario × 488pset1 × 357
check50 × 35
cs50x × 32
c × 24
mario.less × 24
pyramid × 21
pset6 × 19
python × 15
less × 15
error × 14
for-loop × 10
spaces × 10
lesscomfortable × 8
compilation-error × 7
hashes × 7
help × 6
loop × 6
hacker1 × 6
cs50x2019 × 6
morecomfortable × 6
do-while × 6
mario.more × 6
cs50-ide × 5
cs50-pset1 × 5