Skip to main content
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 ...
Blauelf's user avatar
  • 20.9k
2 votes

Incorrect mastercard number in pset1 cs50 2018

If you do the math it should equal 20, which would validate as the last number in the integer is 0. Make sure when a digit is doubled for the first calculation of Luhn's algorithm, you are taking sum ...
Jay's user avatar
  • 23
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. ;-)
Cliff B's user avatar
  • 68.8k
2 votes
Accepted

Hello.c pset1 problem, syntax error near unexpected token `(' and User input problem

From your screenshot, you are typing the code into the terminal itself. That does not work. You should be writing all of your code inside hello.c in the editor. Then, once you have done that, you ...
curiouskiwi's user avatar
  • 18.7k
1 vote
Accepted

Pset 1: Cash help

There are serious issues with the way that you're trying to use IF statements. First of all, "n=x" is always true. A single "=" sign is an assignment operator. In other words, it always assigns the ...
Cliff B's user avatar
  • 68.8k
1 vote
Accepted

Mario Half Pyramid - CS50

Think about what the for loops and i and j are doing. The outer loop is counting the rows from 0 to n-1, which is ok. But look at the inner loop: for (j= i; j < n; j++) Now, say that n = 5. On ...
Cliff B's user avatar
  • 68.8k
1 vote
Accepted

Dealing with pset1's "credit" problem

It's a problem with the for statement setup. Look at the statement: for(int i = 0; i <= digit_number; i + 2) The increment clause i + 2 isn't properly written. This takes the value in i and adds ...
Cliff B's user avatar
  • 68.8k
1 vote

Caesar problem. Keep getting error of segmentation

Strings are immutable. That means that when they are declared, the memory allocated to them cannot be changed. You can put a shorter string in that memory, but not a longer one because it will ...
Cliff B's user avatar
  • 68.8k
1 vote
Accepted

Credit (Pset1) - Do While Loop

Of course it's moving past the while loop. It's just not doing anything that you see before it terminates. Try inputting a 3 digit number and see what it does. The actual problem is here: if (digits =...
Cliff B's user avatar
  • 68.8k
1 vote

CS50 PSET1 Hello, undefined reference to main

try make hello instead of the clang command. There are a series of compiler flags required with clang. The make command will handle it for you.
Cliff B's user avatar
  • 68.8k
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.
curiouskiwi's user avatar
  • 18.7k
1 vote
Accepted

CS50 pset 1 cash problem: keep getting 1 as answer

The problem that you're seeing is here: quantity = round (quantity * 100); So, what is the value of quantity before this line execute? What variable actually contains the value of the change to be ...
Cliff B's user avatar
  • 68.8k
1 vote
Accepted

cash CS50 2020 pset1 modulo

Why are you using modulo for this? It produces an unreliable result in this usage. Further, the actual numbers don't make sense. The modulo function returns the remainder after an integer division. ...
Cliff B's user avatar
  • 68.8k
1 vote

PSET1: Can't check hello.c

Just check50 cs50/2018/x/hello, without mentioning hello.c (as it used to be years ago). The checker will get a list of files to upload. https://docs.cs50.net/2018/x/psets/1/hello/hello.html#code-...
Blauelf's user avatar
  • 20.9k
1 vote

PSET1 Mario More: Same output but still displays error

The problem is simple. There are supposed to be TWO spaces between the left and right sides of the pyramid. It's only partly your fault that you couldn't figure it out. The output from check50 ...
Cliff B's user avatar
  • 68.8k
1 vote

cs50 mario.c more check errors

Looks like check50 got a different file. Maybe you have forgotten to save, or you are in the wrong directory, one where you stored a solution to mario.less? check50 will always upload mario.c from ...
Blauelf's user avatar
  • 20.9k

Only top scored, non community-wiki answers of a minimum length are eligible