Questions tagged [cs50x]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
5
votes
1answer
33k views

How to get a value using flask, from a selected option in a drop down list?

I have the following code for my form in HTML: <div class="container-fluid" id="feedback"> <p><h2>Give us your feedback on the cafe!</h2> <h4><em>...
3
votes
1answer
55 views

Enrolled in 2018, upgraded for certificate in 2019, can I still get the CS50x certificate in 2020?

I first signed for CS50x in 2018, watched the first few lectures and then stopped. I never submitted any problem set back then. This year, I signed up again and this time upgraded for a verified ...
3
votes
1answer
33 views

Why do computers count from zero?

Sorry to ask this basic question but Mr.Malan mentioned in Lecture 0 that computers count from zero. Why is it so?
2
votes
1answer
1k views

CS50 good hash function for PSET5 Speller

I was looking up different hash functions and was getting really confused following what the code was doing. I stumbled upon this hash function: int hash(const char * str) { int hash = 401; ...
2
votes
1answer
7k views

Pset3: Plurality - Weird output!

This program is for counting the plurality for a list of candidates, Check Description for more info, The program works like this: Enter the candidate's name as an argument when running the program ...
2
votes
2answers
1k views

Hello world error

I was trying to make this simple Hello World program, however I receive the following errors. Someone can explain me why? Program: #include <cs50.h> #include <stdio.h> int main (void) { ...
2
votes
2answers
1k views

Web CS50 Project 1: 'flask.cli.NoAppException' flask app with sqlalchemy

I have been banging my head against the wall trying to get this Flask web app running , which is really frustrating because it is only a preliminary to make sure all the modules and such are working ...
2
votes
1answer
177 views

pset3 duration itoa - with "&"

For 'duration' I used the following which works (at least within a testing file), using atoi on individual parts of the inputted string fraction s: double n = atoi(&s[0]); double d = atoi(&s[...
2
votes
1answer
3k views

What is the Advantage of Verified Certificate in CS50

Hello World, I have started the course CS50 as Honor Code. I would like to know what Advantage can I get if I opt. for Verified Certificate. I belong to a economically weak family, so I want to be ...
2
votes
1answer
387 views

CS50 Finance: Register unique username (/check) problem: pythion GET function not working

I am working on the new /check additional on the Finance problem. I am trying to prevent the register form from being submitted when the username is already taken, is empty, or is just one character. ...
2
votes
2answers
3k views

stuck on speller Load function

I am stuck on the load function for speller. I don't quite understand how to insert word into a linked list. This is what I have so far: // Loads dictionary into memory, returning true if ...
2
votes
1answer
3k views

Error: function definition is not allowed here

MY ERROR MESSAGE: ~/workspace/pset3/fifteen/ $ make fifteen clang -ggdb3 -O0 -std=c11 -Wall -Werror -o fifteen fifteen.c -lcs50 -lm fifteen.c:221:1: error: function definition is not allowed here { ^ ...
2
votes
3answers
903 views

CS50 IDE Debugger; not running as expected

When I set a breakpoint in my program and run the debugger, it just stalls on "Listening on port ..." without stopping at a breakpoint, allowing me to view local variables (nor does it even display ...
2
votes
2answers
387 views

Pset4: How does fread add properly to the struct?

In Problem Set 4 we're given the copy.c and bmp.h files. On line 47 the fread() function is called with the arguments, &bf, sizeof(BITMAPFILEHEADER), 1, and inptr. I understand what each of these ...
2
votes
0answers
51 views

Students only passing 4/6 the last two showing concatnation error but works locally somebody help

[33mTraceback (most recent call last):[0m [33mFile "roster.py", line 34, in main()[0m [33mFile "roster.py", line 27, in main print(row[0] + " " + row[1]+" "+ ...
2
votes
0answers
205 views

View README.md in CS50 IDE?

I've created my README.md file for my final project. I'd like to check how it looks before submitting. How can I "preview" markup files in the CS50 IDE?
2
votes
1answer
490 views

CS50's Web Programming with Python and JavaScript on edx project submission

On the following course on edx: CS50's Mobile App Development with React Native CS50's Web Programming with Python and JavaScript I have been trying to submit the project work but it is "Coming Soon!" ...
2
votes
1answer
52 views

How do you delete and/or unjoin a CS50x Space?

I mean a Space in CS50x Apps, which is used to write, run, and share code, all in the same place.
2
votes
1answer
3k views

tideman pset3 cs502020 sort pairs

I started on cs502020 new pset3 -tideman few days ago and haven't been able to figure out how to implement sort_pairs, where one has to sort the struct in an array based on strength of the victory. ...
1
vote
1answer
1k views

Pset7 - :( quote handles valid ticker symbol

Check50 showed me expected to find "28.00" in page, but it wasn't found. I don't know where is my mistake. Can anyone help me out? Any help will be greatly appreciated. Here is my quote(): @app....
1
vote
2answers
989 views

Resubmitting work from my previous CS50x Course

In short, I took CS50x when it was last offered, everything through EdX, I actually found out late, and tried to clear CS50x in two weeks in order to achieve the honor code certificate from HarvardX. ...
1
vote
1answer
240 views

This should be right (Caesar)

After spending pretty much a whole day on this, I have gotten it to work fine, it does all that was demanded but when submitted, I am still getting 1/5 on correctness. :( someone tell me if I left ...
1
vote
3answers
127 views

Why is this while loop generating errors

I'm trying to get a 15 or 16 digits numbers (integers) from users and then using a do while loop to check if the user entered a valid number, otherwise, they will be re-ask to enter the number. THE ...
1
vote
2answers
36 views

C: Pset 3: Binary Search - 'expected an exit code of 0, not 1' (not finding n)

This is an attempt at binary search. n is the user input (from main script). This code compiles but doesn't find the needle in the haystack. I'm a bit lost and would welcome assistance. bool ...
1
vote
2answers
5k views

**SPOILER - COMPLETED PSET** improve CS50 pset4 recover with functions

I've managed to make a working copy of CS50 resize. However, in order to adhere to the thought of not repeating myself, have tried to create a function to create a new file. The program at present ...
1
vote
1answer
355 views

pset4 filter reflect. runtime error: index 601 out of bounds for type 'RGBTRIPLE [width]'

Below is the code that generated the error message. From what i can tell some part of this created a [j] value that was larger than the width. My thoughts on this problem was: With a hypothetical ...
1
vote
1answer
1k views

PSET4 Filter, edge detection process only works for square-like pictures. How to make it work for the whole picture?

I have written my code based on how I structured the code for the blur filter. For some reason the result is pretty weird, the processing of edge detection is only taking place in a square. See ...
1
vote
1answer
4k views

Checking to see if the contents of a string is an integer

Currently I am working on Caesar and validating the user inputs. The argument count section works fine. However, I can't find a way to compare the value in the vector argument string (argv[1]) to see ...
1
vote
1answer
50 views

Caesar code error

My code was running fine except that it does not bring error message when you execute ./caesar with a letter eg ./caesar hey , but it brings the error message when you use more than one argument eg ....
1
vote
1answer
152 views

Pset2 can't crack stelios password

My solution for Pset2 crack works for every password except for stelios's. I can crack other 5 character passwords (e.g., ABCDE, etc.), but for some reason, my code runs for 60m9.563s when trying to ...
1
vote
2answers
91 views

pset 4 - recover: undefined behavior?

I got a question regarding check50 on pset4 - recover. If i run check50 a couple times in a row, without even compiling my code in between I get different results (might be all green smileys or ...
1
vote
2answers
290 views

pset3 music- frequency returns zeroes

I am having trouble with my code, I have spent a really long time trying to figure out why my code is only returning frequency with zeroes throughout. I would really appreciate if some could look at ...
1
vote
1answer
471 views

Credit.c is my nemesis

I have no experience programming, and English is not my first language so I'm struggling a lot with this particular problem. In "credit.c" you have to prompt the user for a credit card number and ...
1
vote
1answer
43 views

What purpose does "eventData" serve in the pset8 source code "$("#q").focus(function(eventData)"?

I have read the jQuery documentation on .focus() as per the pset8 instructions. However, I still do not fully understand the code below: // hide info window when text box has focus $("#q").focus(...
1
vote
1answer
152 views

Problem with CS50 greedy.c. All numbers work except $23 and $4.2

I'm having some trouble de-bugging my code for greedy.c of CS50 Pset1. When I input 4.2, I get 12 instead of 18. When I input 0.2, I get 2 (the correct answer). When I input 4, I get 10 (so here is ...
1
vote
2answers
73 views

mario.c (comrfortable) error code

I ran the test and it was an error #include <cs50.h> #include <stdio.h> int Height; int space; int hash; int rows; int main(void) { do { printf("Welcome to Mario, ...
1
vote
1answer
79 views

Valgrind memory leak, WORDS MISSPELLED: 1 pset5

Looks like your program leaked 1,120 bytes of memory. Did you forget to free memory that you allocated via malloc? Take a closer look at line 48 of dictionary.c. Its weard because i am freeing the ...
1
vote
1answer
8k views

C: Vigenere - incompatible pointer types passing 'char **' to parameter of type 'const char *

I'm trying to iterate repeatedly over key (a word) which the user inputs on the command line. This keyword is used to encipher a word which the user inputs when prompted by the word 'plaintext'. I ...
1
vote
1answer
38 views

Why does this snippet of code work?

I used address of operator on top of derefrence operator. Can you please explain what is happening behind the scenes. Here is my code: #include <stdio.h> int main(void) { int arr[10]; ...
1
vote
1answer
291 views

About the 'crack.c' part of the second hacker edition pset, what is really expected from us? (and a part about submitting)

I'm part of CS50x and I've made a code that would check every single possibility for a password of length 8 or less, but the total number of possibilities here is 96^8, so 7,213,895,789,838,336 ...
1
vote
1answer
15 views

copy.c:70 Is the second %4 needed?

This code here: // determine padding for scanlines int padding = (4 - (bi.biWidth * sizeof(RGBTRIPLE)) % 4) % 4; is the second %4 necessary? wouldn't int padding = 4 - bi.biWidth * sizeof(...
1
vote
1answer
498 views

When do the CS50 lectures get updated?

Ok i could not find a straight answer, so well got to ask. So cs50x is recorded lectures from Harvard's cs50 fall class, as far as I understand. So as of right now the cs50x lectures would be fall ...
1
vote
1answer
15 views

Mario problem: Program got stuck at user input

// ** Below is the code of mario pset1, its taking input of width multiple times and not executing step after input// #include <cs50.h> #include <stdio.h> #include <math.h> int main(...
1
vote
1answer
45 views

Recover - segmentation fault and other general problems

Hey guys so I've hit a bit of a wall with Recover, when I run my program I get segmentation fault but I also don't know how to end off one jpeg when another header pops up? In essence, I'm not sure ...
1
vote
1answer
28 views

pset 4 - recover, can't figure out mistake

I can't figure out what I'm doing wrong, please help! #include <cs50.h> #include <stdio.h> #include <stdlib.h> #define BUFFER_SIZE 512 int main(void) { // open memory ...
1
vote
1answer
371 views

What am I missing ? (pset2, readability)

The problem is that when i run check50 cs50/problems/2020/x/readability into the terminal, it says :( handles questions in passage Cause expected "Grade 2\n", not "Grade 3\n" Log ...
1
vote
1answer
143 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 ...
1
vote
1answer
25 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 ...
1
vote
2answers
195 views

PSET 4 Reflect help

I am not sure why I am having issues with my code. I know I can store the rgb values for the left pixels in 3 temporary variables then assign the right values to the left and the temp values to the ...
1
vote
1answer
69 views

CS50 Tideman sort_pairs does not work correctly

I have checked my code with a few example and all of them returned the right answer. But when using check50, it tells me that my sort_pairs does not work correctly. Please help me :)! #include <...

1
2 3 4 5
17