All Questions

Filter by
Sorted by
Tagged with
0
votes
2answers
20 views

I cannot get the CS50 IDE to run clang for lesson 1

While trying to follow along with the professor during lesson one, I cannot get the CS50 IDE to run clang. I have tried renaming the file, restarting the program, and deleting and starting the code ...
0
votes
3answers
26 views

Even though I get correct output check50 shows error in pset3 plurality problem

#include <cs50.h> #include <stdio.h> #include <string.h> // Max number of candidates #define MAX 9 // Candidates have name and vote count typedef struct { string name; int ...
0
votes
1answer
18 views

pset 5: Repeat Until?

Trying to read strings from file in the [load] function of speller. When using fscanf(), how do I start a while loop until it returns "EOF"? I think there's got to be an easy way to do this, ...
1
vote
2answers
31 views

Valgrind issue on PSET5 - Edited

sorry that this is a repost of a deleted question. I made a mistake in reading the specifications and didn't realise I wasn't able to alter the function declarations in dictionary.c & .h. The ...
0
votes
1answer
16 views

Why doesn't my code give me an output?

So I am very new to CS and I have been working hard twisting this code around in my mind trying to figure out why nothing happens when I run the program. It compiles fine, but whenever I put in any ...
0
votes
1answer
26 views

PSET 5 Speller- all words misspelled + memory leaking issues :(

I've tried fixing this problem for a while now, but I can't seem to figure it out. There are two main issues I am having: Firstly whenever I try running my code "./speller texts/lalaland.txt"...
0
votes
1answer
13 views

*** No rule to make target 'runoff'. Stop. Even though I'm in the correct directory

I keep getting the No rule to make target error on the runoff problem even when I'm in the correct directory as you can see in the picture attached. Note: I have just completed the vote function for ...
0
votes
1answer
27 views

Coin count off by 1 in cash

When I input an amount into the program cash, it gives me one more coin than I should have and I'm not sure how to fix it #include <stdio.h> #include <cs50.h> #include <math.h> //...
1
vote
1answer
24 views

pset 3 runoff help again

I still dont know what to put in for loop :( I still dont know what to put in the for loop for(int k = 0; k < voter_count; k++) { for (int j = 0; j < candidate_count; j++) { ...
0
votes
1answer
39 views

CS50 Houses : Output is correct in my console but error in check50

I am working on the CS50 course by Harvard EDx. The output for CS50 - Houses is correct in my console. However, check50 which is validates and evaluates the response gives an error. I have checked the ...
0
votes
2answers
40 views

Pset 5 Speller - Load function crashing at strcpy?

My program compiles, but in debug50 it seems to get caught in a loop during the first strcpy in load. Any suggestions would be great thanks. // Implements a dictionary's functionality #include <...
0
votes
0answers
39 views

Help please: I keep getting - TypeError: unhashable type: 'dict'

I keep getting - TypeError: unhashable type: 'dict' at line: return HttpResponseRedirect (reverse("encyclopedia:index", { "entries": util.save_entry(title, content) })) My code is ...
1
vote
3answers
26 views

PSET3 Runoff Help Please

for(m = 0; m < voter_count; m++) { for(t = 1; t < 4; t++) { string name = get_string("Rank %i: ", t); } printf("\n"); } } bool vote(int voter, int rank, string name) { ...
0
votes
2answers
51 views

Pset5 Need help, the program doesn't work correctly and I can't find the bug

I have been all day trying to find the bug in my problem but I find it impossible. The program runs correctly at first but the misspelled words are not the ones expected, and then suddenly there is a ...
0
votes
0answers
62 views

PSET6 DNA [SPOILER] Refactor

I have solved the problem however is there anyway to optimize this further? Also, how do I judge the time-space complexity of the same? import csv from sys import argv, exit from csv import reader, ...
1
vote
0answers
62 views

CS50W - Project 0 - “I'm Feeling Lucky”

For the "I'm Feeling Lucky" part, I'm getting a redirect notice (like this: https://images.app.goo.gl/Mgk6knNBYHfe5YKB7). How do I bypass this? Thank you!
0
votes
1answer
20 views

I keep getting “expected EOF” when I use check50

this is the message identifies 4111111111111113 as INVALID expected EOF, not "INVALID" this is the code #include <cs50.h> #include <stdio.h> #include <string.h> #include &...
0
votes
1answer
36 views

PSET5 Speller everything works but then I catch all the words as misspelled

Basically when I run the test with texts/lalaland.txt and compare to the staff's key, they have something like 955 misspelled words and I have all but 5 misspelled. I tried to but a "tolower"...
0
votes
1answer
16 views

My code is not compiling

my code isn't compiling and i don't understand the error message #include <cs50.h> #include <stdio.h> #include <string.h> #include <stdlib.h> bool checksum(string credit); ...
0
votes
1answer
74 views

CS50W - Wiki with Django - I want to edit a wiki entry, but I don't know how to send the default value to the template if I use Django forms

I've tried to do this: class editPage(forms.Form): title = forms.CharField() textContent = forms.CharField(widget=forms.Textarea(attrs={'class' : 'textContent'})) def edit(request,name): ...
0
votes
1answer
35 views

Pset5 Speller - Valgrind displays no leaks but code fails check50

any help would be much appreciated - I've been trawling other questions similar to this one but all the adjustments I have tried to make don't seem to fix the check50 failure. The code seems to run ...
1
vote
1answer
28 views

pset3 Plurality

Having an issure writing my plurality code pset. i wanted to have my programme promt a user when they have made an invalid vote entry. and it works ok but ive found a bug while testing it: code: #...
0
votes
2answers
25 views

readability errors

I keep getting errors on the int i. idk what's wrong with my code #include <stdio.h> #include <cs50.h> #include <math.h> #include <string.h> int main(void) string text=...
0
votes
1answer
25 views

PSET5: Trying to implement dictionary.c using trie. But segmentation fault in check()

My implementation compiles but I am getting a segmentation fault when I execute. My program is working fine through the load function because the output screen shows this "~/pset5/speller/ $ ./...
0
votes
1answer
53 views

Plurality Pset 3 I need Help

Whats wrong i keep getting segfault for(int o = 0; o < n - 1; o++) { if(candidates[o].votes > high0) { high0 = candidates[o].votes; name1 = candidates[o].name; } ...
0
votes
1answer
12 views

When I multiply my array by 2 it doesn't give expected value

Also, please when I try to add "firstnumsum", it doesn't give expected value and I don't know what to do. #include <cs50.h> #include <stdio.h> #include <string.h> #include &...
0
votes
0answers
20 views

Recover Assignment Memory Leak and Insufficient Recovery

I am trying to complete the assignment given by CS50x (Harvard Community Online, edX.org), and while it successfully recovers images, valgrind is telling me that there are memory leaks that happen in ...
1
vote
1answer
27 views

clang-7: error: linker command failed with exit code 1 (use -v to see invocation

I just watched the C lecture the other day, and tried making my first program in the online developer environment (CS50 IDE). Just like the lecture, I am trying to use the compiler command to turn my &...
0
votes
1answer
26 views

Stuck on recover

I am currently stuck on recover and cannot understand the fread function and how does it behave. I have watched all the shorts and explanations but i still don't get it. I also wasn't able to find any ...
0
votes
1answer
11 views

mario.py spacing issue

The program runs fine just that I keep getting an extra line after the user inputs so check50 rejects it because of the \n before # # def main(): hashHeight = height() create(hashHeight) #...
0
votes
1answer
20 views

incompatible pointer types passing 'string' (aka 'char *') to parameter of type 'string *' (aka 'char **')

Im writing a funtion that takes string as a argument and gives back a integer. This function counts lenght of a string entered at the command line argument. I get an error :" incompatible pointer ...
0
votes
1answer
37 views

Pset 4 filter - blur almost works but has a few errors and I just can't figure out why

I've tried changing everything I can think of, but I can't figure out why this isn't working. #include "helpers.h" #include <math.h> int cap (int x); RGBTRIPLE rowend (RGBTRIPLE x, ...
0
votes
0answers
23 views

Getting UndefinedBehaviorSanitizer on pset4 filter blur (less comfortable)

I've tried doing this problem a few ways (without success). This time, I wrote the following code: #include "helpers.h" #include <math.h> int cap (int x); RGBTRIPLE corner (RGBTRIPLE ...
0
votes
0answers
44 views

PSET8 Finance Buy

For some reason, my buy function will not work. When I try to "buy" a share of stock, it always goes to internal server error. Here is my code: def buy(): if request.method == "POST&...
0
votes
1answer
32 views

Segmentation Fault with Problem Set 4 (Recover)

I am getting a segmentation fault when running my program that only allows me to print out 1 broken image. However, when I run the program with valgrind it prints out 49 of the 50 photos, and the only ...
0
votes
1answer
14 views

getting undefined behaviour sanitiser deadly signal error which crashes everything when trying t run greyscale filter on pset4!

The below image shows my code and all the errors that come when I run it. I have to exit the terminal and start again to do anything! I don't understand what is wrong with the code. I have looked ...
0
votes
0answers
14 views

my count is not working for csv.large [closed]

for j in range(len(STRs)): inilist = [i for i in range(0, len(sequence)) if sequence[i:].startswith(STRs[j])] for k in range(len(inilist)): k += 1 ...
0
votes
0answers
17 views

I have been trying to fetch book reviews from Goodreeads API

I got this sqlalchemy.exc.ProgrammingError sqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) can't adapt type 'RowProxy' while trying to fetch book reviews from Goodreads API with the ...
0
votes
3answers
72 views

Why So Many Check50 Errors on Caesar? Results match expected output

Of the 11 Check50 checks, only 4 check out correct but when I run the code with the Check50 inputs, my outputs match the expected outputs, so why so many errors? Here is a link to my Check50 results: ...
0
votes
0answers
28 views

For pset4/recover i keep getting an error despite the pictures recovering when i run the program

could someone please identify whats wrong with my code. im a beginner and completely lost.
0
votes
0answers
12 views

segmentation fault when i compile my program

int main(void) { long long cardnumber = 0, calc; //string credit[1]; //string lengthkey[1]; string credit[1]; string lengthkey[1]; int countcardcharacters = 0; //user ...
0
votes
2answers
28 views

Why does my code lead to segmentation fault [CS50 recover.c]

#include <stdio.h> #include <stdlib.h> #include <cs50.h> int main(int argc, char *argv[]) { if (argc != 2) { printf("./recover file_name\n"); ...
0
votes
1answer
37 views

Pset7 houses - why does my output prints thrice instead of once?

The code is as follows: for row in students_list: first, middle, last, birth = row["first"], row["middle"], row["last"], row["birth"] print(f"{...
0
votes
1answer
34 views

PSET5 Compiling issue

So I finally finished my code and received 20 errors when attempting to compile, after my first attempt fixing the errors I tried again and received 15 errors, once more and received 17, and now am ...
0
votes
2answers
35 views

Can't pass the test on readability

So, I think function 'round' in one case does rounding to the Grade 8, instead of Grade 7. But, if I remove it, another text getting wrong grade. in both cases the grade of either one text is wrong. ...
0
votes
0answers
8 views

Issues with PSET4 Filter Edge Detection

I've been testing my edges code for ages now but I can't seem to figure out the problem. When I run the code on the sample images the images look like they have been processed properly but when I put ...
0
votes
0answers
11 views

PSET 6 Python Cash incorrect results

I am convinced that my code is right. Yet I am not getting the right results for the following: :( input of 0.41 yields output of 4 :( input of 0.15 yields output of 2 The code is below: def main(): ...
1
vote
1answer
16 views

CS50.h library in ubuntu

every time i create program i have to write "clang prog.c -o prog lcs50" link with cs50 but when I try "make prog" it prints following error: /usr/bin/ld: /tmp/cc8noHLN.o: in ...
0
votes
1answer
7 views

Check50 Substitution error

I am able to execute the code with any errors. The solution(output) to the examples given in the problem set 2 match my solution and yet check50 shows there are a number of issues in the output. ...
0
votes
1answer
52 views

PSET4 - Need help with Recover problem

I am stuck in this problem, when I run it I keep getting a segmentation fault. I think that the bug in my code is in the while loop. In the walkthrough of the problem it was suggested to check if ...

15 30 50 per page