Hot answers tagged

8 votes
Accepted

How to approach the psets?

I think this is typical specially if this is your first CS/programming course. Thinking: You should probably consider these points: you, as a human being, should be able to solve the problem ...
user avatar
  • 17.3k
4 votes

Can I add the solutions to all the psets I solve to my GitHub account?

The Honor Code requires that you don't post any solution code publicly, so it should be fine if your git is private.
user avatar
  • 18.3k
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 ...
user avatar
3 votes
Accepted

Gradebook issue

I found why grade were 0 in PSET2 ,it was all my mistake. Programs were correct, but the problem was i didn't have the CS50 appliance. So i didn't check the programs with checkCS50. I thought ...
user avatar
3 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 ...
user avatar
  • 20.7k
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 ...
user avatar
  • 63.1k
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 ...
user avatar
  • 63.1k
2 votes
Accepted

Standard or Hacker or Both

If you are doing this course via edX, you must submit the Standard editions. The Hacker editions are only for your own extra learning.
user avatar
  • 18.3k
2 votes
Accepted

Unable to login, to submit pset0. Signed in with Google

When you registered for edx with your Google account, you must have specified a password. The form requires it. Use that password and your username, and it should work. If you forgot your username, it ...
user avatar
  • 1,211
2 votes
Accepted

pset4 - Recover - doesn't pass check50 but works

It's interesting that you get 50 files, but something is amiss. Look at your test for signatures: if (buffer[0] == 0xff && buffer[1] == 0xd8 && buffer[2] == 0xff && buffer[3] &...
user avatar
  • 63.1k
2 votes
Accepted

PSETS are not available

Are you sure you are in the correct link and that you are signed in? Try this: https://courses.edx.org/courses/HarvardX/CS50x3/2015/courseware/. I can see all of the weeks and the psets.
user avatar
  • 7,326
2 votes

Problem set 6 method not allowed

Hmmm..... char method_checker[4]; method_checker[4]= '\0'; You are setting '\0' one element beyond the end of method_checker[]. This is also probably leaving garbage data at method_checker[3] ...
user avatar
  • 63.1k
2 votes
Accepted

Pset5 Speller Load / Check Problem

I think the problem is because, when inserting, you're checking and/or allocating memory for cursor->children[c - 'a']. Now if c is an uppercase char, that's a problem. Update: I don't really know ...
user avatar
  • 17.3k
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.
user avatar
  • 18.3k
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 ...
user avatar
  • 63.1k
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. ...
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 ...
user avatar
  • 63.1k
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 ...
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 ...
user avatar
  • 20.7k
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 ...
user avatar
  • 63.1k
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 ...
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"); ...
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 ...
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... } ...
user avatar
  • 7,326
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 ...
user avatar
  • 7,326
1 vote
Accepted

pset 3 Binary search

First - think about what a segmentation fault is. It happens when you try to access memory that doesn't belong to you. https://stackoverflow.com/questions/2346806/what-is-a-segmentation-fault Try ...
user avatar
1 vote

How should I connect to the multiple databases?

Admittedly I don't fully grasp what you mean "merge several psets". However,in the narrow and specific context of CS50 pset7 & pset8, you do not need two databases. Consider adding the places ...
user avatar
1 vote
Accepted

Returning 2015 student (Starting fresh)

Yes they will. The grading will be done according to your last submission. I have submitted more than one solutions for half of the psets. Got the grades according to the last submission.
user avatar
1 vote
Accepted

What's wrong with my pset 3 fifteen.c code?e

You have created an infinite loop through the improper use of the decrement operators. Look at the following: // switch numbers 2 and 1 board[j][i--] = 2; board[j-...
user avatar
  • 63.1k
1 vote

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 ~/...
user avatar
  • 63.1k

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