Questions tagged [cs50x]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
18 views

PSET 1 CASH stuck!

I am stuck with this problem. I'm wondering how to use the functions given to us at the top of the page (the template that was created after downloading the zip drive). There is a function about ...
0
votes
1answer
10 views

PSet1 - No such file or directory

I am working on pset1, mario-less comfy, and while trying to test the code to prompt for height, I am running into an message stating that there's no such file or directory. Can someone please help ...
1
vote
2answers
25 views

Stumped on PSET 1 Mario Less Comfortable

I've been working on this for a while and feel stuck. I think that my "for" loops might be out of order or some other issue. Suggestions? Thanks
0
votes
1answer
20 views

bash: make: command not found

I'm using VS Code online version provided by CS50, if I'm not wrong. When I try to compile my code before running it via "make hello" I get this error: "bash: make: command not found.&...
0
votes
1answer
10 views

pset1 quarters doesnt return output correctly

{ // TODO int quarters = 0; do { cents -= 25; quarters++; } while (cents >= 25); return quarters; } above is what happens when i test the code. tried ...
0
votes
1answer
4 views

Not sure where this file exists? Week 1 Lecture 1 - C what do I do so I can run the code from 1:07?

Trying the run the code for addition. He started the screen share with a blank so I did too with only the ~ directory with only hello and hello.c. I created a new file as he did named Untitled1 but ...
0
votes
1answer
11 views

Caesar, trying to only accept digits help

I am trying to only accept digits. I turned Argv1 into an int with atoi, and used isdigit to confirm it is a digit being typed in. Why is it accepting both characters and digits?
0
votes
0answers
15 views

check50 doesn't work after cs50x migration to new VS ide

Your help is appreciated! check50 doesn't work in the new VS ide after migration (pset9): bash: cs50/problems/2022/x/finance: No such file or directory
0
votes
1answer
13 views

Need Help, why does my debug50 show a correct result but when i run the program, thus it shows a wrong answer

Here's my code #include <cs50.h> #include <stdio.h> #include <math.h> //1:26:36 / 2:24:59 int main(void) { long n; int exc; do { n = get_long("Enter your ...
0
votes
1answer
20 views

How do I get rid of the "expression result unused" error?

I am trying to get it to where if input "n" and "x" are the same number it will display "years = 0" if not it will run else statement. Instead it was running both the if ...
0
votes
1answer
15 views

Recover: invalid or unsupported image format. All new jpegs show in folder

// Recovers Jpegs from Memory card #include <stdio.h> #include <stdlib.h> #include <stdint.h> typedef uint8_t BYTE; int main(int argc, char *argv[]) { // Return 1 if more then 1 arg ...
0
votes
1answer
12 views

substitution question segmentation fault issue

I am doing the substitution question and I keep running into this segmentation fault issue but i do not understand what exactly is causing the memory access issue. once j=4, the memory fails to be ...
0
votes
0answers
17 views

PSET1 Credit error mistake

Hope this finds you well. I am having a little bit of trouble with PSET 1s credit problem, the code compiles fine but when running check50 it gives me a few errors. I tested one of the errors, where ...
0
votes
1answer
13 views

What is the problem with my get_int for the lab 1 question population in C?

when i make the code and i type ./population, the question asked is start size:, and when i type in an x value that is 9 or more, the question keeps reprompting and I keep looking through and I don't ...
0
votes
1answer
20 views

Do I need to write a pseudocode to all problem sets and labs?

In the problem sets and labs most of the time the staff don't ask to write a pseudocode. So if they don't write anything about writing the pseudocode in a text file, I don't have to write a pseudocode ...
0
votes
1answer
22 views

PSET3 Runoff - Tabulate (multiple candidates)

I am stuck at this error for hours, I would appreciate your help. There is two errors: :) tabulate counts votes when all candidates remain in election :) tabulate counts votes when one candidate is ...
0
votes
1answer
10 views

No such file or directory (following video instruction)

See picture. Doing exactly the same as the instructor does in the vidoe but somehow it is not working. Thanks in advance for your help!
0
votes
1answer
21 views

Stuck on 'runoff'in pset3

I have been working on the runoff assignment from week 3. I am having issues with two of my functions: tabulate() and print_winner(). I have implemented them in the following ways: Here my ...
0
votes
1answer
32 views

I'm having a segmentation fault on Inheritance, Lab 5

I've narrowed it down to line 57 x->alleles[i]=x->parents[i]->alleles[0]; I don't understand why it's not working, any help would be appreciated. Here's the full create_family function: // ...
0
votes
1answer
74 views

Inheritance - Lab 5

#include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <time.h> // Each person has two parents and two alleles typedef struct person { struct person *parents[2]; ...
0
votes
1answer
15 views

Plurality exercise - error messages

I am trying to do the Plurality exercise for problem set 3, but when I type this to test it, I get errors even though I believe my program looks correct. check50 cs50/problems/2021/x/plurality I get ...
0
votes
0answers
20 views

What is the best approach to DB design? (CS50X PSET9)

I'm pretty excited going over the pset9, however, I have a question when it comes to db design. The following text might be a spoiler to the solution of the problem set, beware. Given the above ...
0
votes
1answer
48 views

PSET9 Finance - Check50 Failing on login - logging in as registered user succceeds - IndexError: list index out of range

I have been struggling with the Finance problem for a while. Upon running the check50 command, I get the following error: :( logging in as registered user succceeds Cause application raised an ...
0
votes
0answers
18 views

CS50 PSET3 Tideman Help!

I'm having a little trouble with the add_pairs function because the pairs array refuses to store numbers. I used printf to corroborate the values that were being recorded, and the i and j ints don't ...
0
votes
2answers
26 views

Pset3 Runoff CS50x

I have been trying to debugg the program for a while but am not able to figure out what the error in line 9 is as this was the code provided by the courses and I didn't make any changes. Any help ...
0
votes
0answers
25 views

Can someone please help me I am trying to find what is it I am doing wrong here in pset1

I am in the dir ~/pset1/hello but it gives the same error again and again it does not show anything in the ls command.
0
votes
0answers
15 views

sort_pairs fails check50 tideman using selection sort

My sort_pairs function fails the check50 **:( sort_pairs sorts pairs of candidates by margin of victory ** test however it passes the usage case given on the CS50 website. I am using selection sort to ...
0
votes
1answer
88 views

My CS50 PSET4 Filter (Less) Blur function doesn't pass check50 despite seemingly working fine

I've been working on CS50 PSET4 Filter (Less) and finally got a working blur function (or so I thought!) // Blur image void blur(int height, int width, RGBTRIPLE image[height][width]) { RGBTRIPLE ...
0
votes
1answer
20 views

Pset4 Filter edges - seems to work but does not get approved

The output looks correct. I manually calculated the values for one single pixel and printed out the calculated values in the function using printf() and the values were almost the same, with a slight ...
0
votes
0answers
17 views

NameError in Pset: Finance

Cause application raised an exception (see the log for more details) Log sending POST request to /login sending POST request to /buy exception raised in application: NameError: name 'stock' is not ...
0
votes
1answer
38 views

I believe my code is right but it's not giving output and pops segmentation fault

This is my code for Caesar Pset2. The code must be doing right but it's broken somehow. #include <stdio.h> #include <math.h> #include <string.h> #include <ctype.h> #include <...
0
votes
0answers
22 views

CS50 Finance Error: Expected something but got other

I'm struggling with register function in application.py since I am having error messages in check50 That says: :) register page has all required elements :( registering user succeeds expected ...
0
votes
0answers
79 views

CS50 Week9 Finance I have an error in register

I'm struggling with register function in application.py since I am having error messages in check50 That says: :) register page has all required elements :( registering user succeeds expected ...
0
votes
0answers
28 views

How to sort an array of strengt by victory using bubble sort (pset3: Tideman)

I wrote this code... void bubbleSort(void) { // loop to access each array element for (int step = 0; step < pair_count - 1; ++step) { // loop to compare array elements for (int i = 0; i < ...
0
votes
1answer
37 views

How does csv.DictReader know what to call the keys in the dictionaries it creates?

In Lab 6 - world cup - you are given a csv file with two columns of values. When reading that file, many solutions I found use csv.DictReader to read each row of the csv file as a dictionary. They go ...
1
vote
1answer
17 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(...
0
votes
1answer
34 views

How can I change my certificate name?

I have finished the course in the past month and noticed there were a typo on the certificate name. Is there any way to fix that? Where is CS50 picking my name?
0
votes
1answer
13 views

CS50 ide. Not being being able to compile program

Whenever i try to compile the program in the cs50 ide this error shows up- make: *** No rule to make target 'string'. Stop. Can someone please help me out. Thanks!
0
votes
0answers
19 views

error: address of stack memory associated with local variable

I have the following function: string encipher( string plaintext, string key) { int size = strlen(plaintext); char ciphertext[size]; // For each alphabetic charaters determine what letter ...
0
votes
0answers
22 views

Why do Escape Sequences in C work differently when I compile code by using GCC?

Why do Escape Sequences in C work differently when I compile code by using GCC? For example, Input: #include <stdio.h> int main(void){ printf("Hello world\n"); } Output in CS50 ...
0
votes
0answers
35 views

Pset9 problem at check50 tests

hello, i've tried "112.00" in my solution and cs50's solution and the result is same "invalid shares" but i don't know why this error occur. i'm really stuck any help please
0
votes
1answer
24 views

Unable to complie PSET3

I tired compiling my code, many time but it shows :( tideman compiles code failed to compile. Can anyone take a look. Another thing that i want to ask is my code well written? Because i feel it's too ...
0
votes
0answers
28 views

CS50X Finance: check50 says buy isn't handling valid purchase. But it is handling fine

I'm wondering what is being tested because its looking for the value 112. expected to find "112.00" in page, but it wasn't found I'm flashing the result of the buy transaction on the index....
0
votes
1answer
20 views

PSET4/Recover -- Why am I getting "double free or corruption (top)"?

#include <stdio.h> #include <stdlib.h> #include <stdint.h> typedef uint8_t BYTE; int counter = 0; char filename[8]; FILE *img; BYTE buffer[512]; int main(int argc, char *argv[])...
0
votes
1answer
46 views

What mistake am I doing in the below "buy" and "sell" code.? I get the below errors from check50

I get the below error from check50: :( buy handles invalid ticker symbol application raised an exception (see the log for more details) :( buy handles fractional, negative, and non-numeric shares ...
0
votes
1answer
24 views

Not sure why code isn't working: PSet4 Filter (less) - Blur

I'm not sure why my code doesn't work for the blur section of pset4 (filter; less)? (I am aware there's a more efficient way to do this, but am interested in learning what's wrong with this specific ...
0
votes
1answer
12 views

error : function definition not allowed here pls help

i got this error message pls help $ make triangle clang -ggdb3 -O0 -std=c11 -Wall -Werror -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wshadow triangle.c -lcrypt -lcs50 -...
0
votes
1answer
13 views

pset2//caesar : strspn result

I'm struggling to understand : (argc != 2 || argv[1][strspn(argv[1], "1234567890")]) It works, but I'm trying to understand what's going on inside the if evaluation, and the value argv[1][...
0
votes
1answer
80 views

CS50 Finance index doesn't display what it needs to

I'm at the last check for the 'buy' part and I keep getting: :( buy handles valid purchase expected to find "9,888.00" in page, but it wasn't found I'm pretty sure that number is supposed to ...
0
votes
1answer
63 views

CS50 blur filter failed 3x3 and 4x4

I created a for loop checking each pixel around the one to be blurred. If the pixel was in range, its RGB values would be added to a total variable to then be averaged. My program works for all ...

1
2 3 4 5
18