Skip to main content
7 votes
Accepted

CS50 IDE undefined reference to `get_int'

On which version of the workspace are you? The current version as of 2017-11-13 is v125. If update50 doesn't end in an error message, you probably are at that version. Also, how do you compile? The ...
Blauelf's user avatar
  • 21k
4 votes
Accepted

This should be right (Caesar)

The output does not match the spec. This plaintext : should be this plaintext:. The same with ciphertext:. There is no space between the word and the :. While this may seem "overly strict", it is good ...
DinoCoderSaurus's user avatar
3 votes

No such file or directory, pset1

It looks as though you don't have a full understanding of how directory structure works. Looking at the image that you posted, you have already created the subdirectory pset1 in the directory ~/...
Cliff B's user avatar
  • 69k
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 ...
Cliff B's user avatar
  • 69k
3 votes
Accepted

CS50 pset2 substitution - timed out while waiting for program to exit

It's failing because the code isn't handling invalid keys correctly. For the cases where the key contains a number or a duplicate letter, the program should terminate. Check50 is timing out because ...
Cliff B's user avatar
  • 69k
2 votes
Accepted

imprecision problem cs50 greedy

You need to round the result of change * 100. You can do that simply with the round function found in math.h. For example, round(4.2*100) would return 420, where 4.2*100 gives 419.
curiouskiwi's user avatar
  • 18.7k
2 votes
Accepted

PSet 2: Caesar, validating key

The problem lies here: if(isdigit(argv[1][i] != true) You need to fully understand how isdigit() works, specifically the return value, and the numeric value of true. The is() family of functions ...
Cliff B's user avatar
  • 69k
2 votes
Accepted

Problem Set 6 - DNA (Using the DictReader function)

Got the solution via a very cheeky way; storing the values in a list, checking each row of values for each STR, then comparing those database values with the ones I got using my count function. ...
Sorphil's user avatar
  • 27
2 votes

check50 on recover pset 4 saying this what am i doing wrong

The program is supposed to take the filename of the input file as a parameter. BUT, you've hardcoded it into the program. So, when check50 tests to see if the program terminates when there's no input ...
Cliff B's user avatar
  • 69k
1 vote
Accepted

Problem Set 4 - Filter (Blur)

for (int i = 0; i < height; i++) { for (int j = 1; j < width; j++) { Your j variable here shouldn't start at 1.
TLH's user avatar
  • 312
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
  • 69k
1 vote
Accepted

Check50 has Blank Output

Would have been great had you stated The problem (preferably with a link to the problem statement) How you tried to invoke check50 The link to the result as text, not a screenshot, or a sanitized ...
Blauelf's user avatar
  • 21k
1 vote
Accepted

I need help with cash - again

Cut and paste error. What is the value of a dime? A nickel? A penny? I'm sure it isn't 25 cents each! ;-) When you get to the point that you're not seeing the forest for the trees, as is the ...
Cliff B's user avatar
  • 69k
1 vote
Accepted

music pset - semantic error

The part of this question which is easiest to understand is the part about your implementation of get_string(). The function get_string{} is supposed to return as soon as the user inputs a string. ...
Peter Pesch's user avatar
  • 1,009
1 vote
Accepted

Trying to use functions to modify pset2 Caesar characters, get error: expression result unused for each function

It's exactly what it says. You have written an expression: (character+key) % 26 + big_letters; but you aren't setting the results of that expression to anything, hence it is unused. You're doing ...
curiouskiwi's user avatar
  • 18.7k
1 vote

Which loop can be replaced for nested for loops for PSET 1 (Mario More Comfortable)?

There's no problem with having 5 for loops. However, there are several problems with having 5 nested for loops: It's hard to keep track when reading your code That makes it for other people to ...
Peter Pesch's user avatar
  • 1,009
1 vote
Accepted

pset1 cash.c Do While loop executing even when condition = false?

It's doing exactly what it was told. Remember the differences between a while loop and a do/while loop. A while loop can only execute if the condition is true because the test condition is checked ...
Cliff B's user avatar
  • 69k
1 vote

CS50 Pset 4/Recover-retains 50 broken JPEGs

When the code finds a signature, it opens a new file and writes the buffer out. Then, in the code that is meant to handle the blocks of image data that follows, it writes the signature block out a ...
Cliff B's user avatar
  • 69k
1 vote
Accepted

Blank jpegs pset 4 recover

The code above searches for signature blocks and, when found, closes the previous file and opens a new file. While it will correctly skip the garbage data before the first signature block, it will ...
Cliff B's user avatar
  • 69k
1 vote
Accepted

Pset5: Check returns all as misspelled (trie)

The problem is that you do not check is_word of the current node as your loop is over at the moment when your are in the right place. let's suppose it is word "a". So n= strlen(a) = 1. You check trav ...
obesman's user avatar
  • 1,139
1 vote
Accepted

pset2 Caesar, not able to print chypertext text

Simply put, your code is producing non-printable characters. If you'd like to see the value that is being calculated, try printing the letters out as %i integers. The code is applying the modulo ...
Cliff B's user avatar
  • 69k
1 vote

initialization; condition; update in mario.c less comfortable

Well, why is a loop necessary in the first place? To repeat a bunch of steps. What steps can building a pyramid be broken down into? Building its layers (lines). How many lines tall should the ...
ArtemPetrov's user avatar
1 vote
Accepted

any one having trouble opening Pset links

You can look up the problem sets (not the solutions, but the actual instructions) on Google. For example, looking up Problem Set 1 C CS50 has the problem set link as the first result, which you can ...
SuperNovaCoder's user avatar
1 vote
Accepted

pset2//caesar- relational operator result unused error

First to the error: i<len,k>=0 uses the comma operator, which evaluates its left side, discards the result, and evaluates to its right side. So i<len,k>=0 is the same as k>=0, the value ...
Blauelf's user avatar
  • 21k
1 vote
Accepted

problem resizing horizontally

So, where do you set the contents of old_bi? Tip: get everything working for n=1 - first the header and then the image. Then do n=2, get the header right and then the image. ;-) If this answers your ...
Cliff B's user avatar
  • 69k
1 vote
Accepted

Set foreign key in phpLiteAdmin

If by this recommended syntax for adding a column using SQLite does not appear to work. you mean foreign key is not enforced, check out section 2 in SQLite doc, which says Assuming the library is ...
DinoCoderSaurus's user avatar
1 vote
Accepted

Recover is Producing Corrupt JPEGS

There's a problem in this routine: else if (found_jpeg) { printf("Writing to existing JPEG...\n"); sprintf(fn, "%03i.jpg", jpegs); FILE *img = fopen(fn, "w"); ...
DinoCoderSaurus's user avatar
1 vote
Accepted

APCS50 Problem: Fahrenheit

The GetFloat() function takes no input, so you should not perform arithmetic on it as that results in errors like the one you are seeing. If you want to output the converted value as a float, you ...
kluvin's user avatar
  • 1,223
1 vote
Accepted

PSET 2: Nested IF statement

You have made a mistake that is very frequent among novice programmers, you check for the returned bool using ==. You should instead use something like: if (islower(text[i])) { // do things... } ...
ChrisG's user avatar
  • 7,396
1 vote
Accepted

pset4 Resize - Trouble Understanding Padding

According to MSDN biSizeImage The size, in bytes, of the image. This may be set to zero for BI_RGB bitmaps. If biCompression is BI_JPEG or BI_PNG, biSizeImage indicates the size of the JPEG or PNG ...
ChrisG's user avatar
  • 7,396

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