6
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 ...
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.
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 ...
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
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 ~/...
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 ...
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] &...
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.
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] ...
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 ...
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.
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 ...
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.
...
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 ...
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.
...
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 ...
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 ...
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 ...
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 ...
1
vote
completed speller however a bug(works fine with small data shows 0 misspelling with large dictionary)
fixed apparently the problem was in how I was using strcmp to detect differences
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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");
...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible