Questions tagged [cs50x]

The tag has no usage guidance.

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

Sentence count stuck at 2 in readability

#include <stdio.h> #include <cs50.h> #include <ctype.h> #include <string.h> int main(void) { //Retrieve string of text from user string s = get_string("Text: &...
0
votes
1answer
14 views

Question about Pset1 - credit

I had work on the credit for 3 hours, and I had reach to most of the function - and I checked that the number received from: Luhn (a) last digit(c) and digit count (cc) are right by using ...
0
votes
1answer
12 views

pset2 Readability test question

This is what I have so far. I realized that when counting letters there are more symbols you must exclude, but I am not sure how to do that. Also, my program isn't running for some reason and I am not ...
0
votes
1answer
11 views

CASH NOT UPDATING - FINANCE SELL

so everything I have so far is working except the part where I need to update the cash right after I sell a stock. As you can see in the table below what's happening is that everytime I sell a stock ...
0
votes
0answers
20 views

Pset4 Filter: Blur Issue

So this is my first time using Stack Exchange, I have been relying on reddit so far for cs50 however I am stuck on blur. Someone on reddit told me I have to "create a temporary container that is ...
0
votes
1answer
9 views

how to autofit a webpage to any screen size

I am pursuing web track for pset8. I am using fixed number instead of percentages for size of each element. How can I make sure that the webpage can fit to all screen / window sizes without getting ...
0
votes
1answer
14 views

Trying to do pset 2, but it doesn't even accept my input. What am I doing wrong?

#include <stdio.h> #include <cs50.h> #include <ctype.h> #include <string.h> #include <math.h> int check(int c, string key); int main(int argc, string argv[]) { int ...
0
votes
1answer
23 views

When i run this code below, errors pop out error: like subscripted value is not an array, pointer, or vector edgeimage[i][j] = image[height][width];

void edges(int height, int width, RGBTRIPLE image[height][width]) { //Set temp image RGBTRIPLE *edgeimage = malloc((height + 1) * (width + 1) + 4); //RGBTRIPLE edgeimage[height][width]; //Go ...
0
votes
1answer
10 views

i m getting segmentation fault in my code for cs50 caesar

#include <stdio.h> #include <cs50.h> #include <stdlib.h> #include <ctype.h> #include <string.h> int main(int argc, string argv[]) { //getting correct input for KEY ...
0
votes
1answer
17 views

PSET 7 HOUSES - Syntax error on case function

I'm trying to select the first name and last name and ONLY select the middle name when there is one. The logic of my query makes sense. Every time I am extracting the first name, last name, and birth. ...
0
votes
0answers
31 views

PSET5 dictionaries won't load

I cannot get my dictionaries to load and cannot figure out why. Here is my load function: // Loads dictionary into memory, returning true if successful else false bool load(const char *dictionary) { ...
0
votes
1answer
35 views

Pset5: Speller. incorrect counting of mispelled words

I've been working on this code for the last two weeks... I load the correct # of words into the dictionary, but I get an incorrect number for misspelled words. I believe its an issue either with my ...
0
votes
1answer
40 views

pset3 Tideman: checking for cycles

I made it so that if a losing candidate in any pair wins in another, a function checks whether there's the losing candidate in that pair wins in any other, and so forth. this here is the unlocks the ...
0
votes
1answer
22 views

pset4 filter: blur check50 shows same values, but is returning an error

The blur image seems to be working and according to the error I am seeing, it looks like it is getting the right values, so I thought it might be a rounding error, but I have tried every combination ...
0
votes
2answers
19 views

CS50 pset4 filter reflect issue

i am missing something here...but not sure what... it doesn't work on normal images... check50 passes for 1X2 and 1X3 images but fails for 3x3 and 4x4 images (so i guess it is an issue of iterating ...
0
votes
3answers
39 views

PSET6 Mario Python

I have been experiementing with this code for a couple hours and have come across an issue with each implementation. I can no longer put in any time at the moment so I figured I would go ahead and ask....
0
votes
1answer
18 views

Looking at Posts with regards to Academic Honesty

Does anyone know if getting help from a post that contains spoilers is considered academically dishonest? I'm not sure because even though the spoiler code in the post isn't an outright solution to ...
0
votes
0answers
8 views

Pset4 filter (more) - Edge Help

I stuck on pset4 for days. Only the corners passed check50. Any help, please? void edges(int height, int width, RGBTRIPLE image[height][width]) { int cap (int c); //get a copy of all the ...
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
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
1answer
75 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
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 ...
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
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
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 ...
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
51 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; ...
0
votes
0answers
53 views

Confused about DNA in pset6

I've just started DNA, and I've got what seems to be a working algorithm to see if the count of the STRs in the database and sequence are the same, but it does not seem to be working. I've been a bit ...
0
votes
1answer
30 views

pset4 filter - blur function only filters image corners

This is my second attempt at this problem, and a full rewrite; I tried once before to be as eloquent as I could, and it was just totally wrong and bizarre. So I just tried to make this one as readable ...
0
votes
1answer
27 views

HELP! Pset1 Credit

I got a question on the credit. I don't know why it automatically quit. Like this: ~/pset1/credit/ $ ./credit Number: 4003600000000014 ~/pset1/credit/ $ Please see the code below. #include <cs50....
0
votes
2answers
33 views

how do i write pesudocode.txt for Mario? (less comfortable)

After I input: mkdir ~/pset1/mario its asking me to write pseudocode.txt and i am not sure how i can do that. I've tried inputting the pseudocode.txt and that gives me "command not found"
0
votes
0answers
44 views

PSET 6 DNA! Stuck for so long

so the problem I face is when computing the greatest number of STR's in a sequence. I was able to hardcode "GATA" and compute the greatest sequence for a textfile using my sequencecount ...
0
votes
1answer
19 views

Pset1 Creating and Changing Directory Does Nothing

For the first problem set, I attempted to create and change the directory with the following commands: $ mkdir ~/pset1 $ cd ~/pset1 $ mkdir ~/pset1/hello $ cd ~/pset1/hello Despite doing these ...
0
votes
2answers
26 views

are we supposed to use the set from hello.c to begin with Mario (less comfortable) or do we need a new terminal and file?

the first thing that the Mario instructions say is this : First, create a new directory (i.e., folder) called Mario inside of your pset1 directory by executing ~/ $ mkdir ~/pset1/mario. I do not ...
0
votes
1answer
17 views

CS50 Runoff – Cannot get program to execute, am I stuck in an infinite loop somewhere?

I'm trying to execute runoff but after I enter the voters' ranks, the terminal window blinks back at me with nothing. I've scoured all over for similar problems but cannot figure out a solution. I've ...
0
votes
0answers
29 views

PSET 6 - credit, pythonic or not?

I didn't do credit for problem set 1 (I chose less comfortable) so I don't know what the C implementation was. I was wondering if you guys think this is too C-like or if it's okay for python code. Any ...
0
votes
1answer
36 views

pset4 / recover / invalid or unsupported image format

I've been working on RECOVER from PSET4. I'm able to compile and it creates all 50 images. When I try to open any of the images I get an error saying "invalid or unsupported image format". I'...
0
votes
0answers
53 views

CS50 - PSET2 - Substitution Segmentation fault

I keep getting 'Segmentation fault' every time I run the code(mentioned below). The code is compiling just fine. It's asking for input and is returning required message when the command line argument ...
0
votes
1answer
24 views

Query related to Mario program(more) in CS50 pset1

I can't figure out the problem in my code, it successfully creates a pyramid but doesn't reprompt when value other than 1-8 is entered, also it gives a space before printing the pyramid, causing ...
0
votes
1answer
41 views

pset4 / recover Segmentation Fault

I have been trying to solve RECOVER from PSET4 and I keep getting a segmentation fault. Any ideas on why this happens? Thank you so much for any help. #include <stdio.h> #include <stdlib.h>...
0
votes
0answers
51 views

PSET 5 SPELLER - HELP!

i'm not sure why this happens when I execute the code. The program seems to never end as if it's running an infinite loop. When I run valgrind on it misspelled words keep spewing out and it gives me a ...
0
votes
0answers
8 views

Project 0 submission date

Hope you are doing well. I wanted to inform you guys that i had enrolled in this course on 6/26/2020, and now the course material has been changed. Can someone please tell me that from where i can ...
0
votes
1answer
28 views

PSET 5 SPELLER - seg fault

I need help with my unloads function. I keep getting a segmentation fault on "while(cursor->next != NULL)." When I hover over the "cursor->next" part it says no value. I don'...
0
votes
0answers
30 views

CS50x pset2 substitution, check50 test returns negative even though output is correct

My code fails only one of the test in check50 even though the output is correct and passes other ones. The test it fails: :( encrypts all alphabetic characters using DWUSXNPQKEGCZFJBTLYROHIAVM as key ...
0
votes
1answer
21 views

PSET 5 SPELLER - segmentation fault

I keep getting a segmentation fault on my load function when using the debugger. Specifically, the line with "if(table[num]->next != NULL)" is what is causing it. I need some help, please....
0
votes
1answer
49 views

Finance - Error with Index

I can't seem to figure out where I've gone wrong with index. I keep running into these two errors: After login, when directing to index - 500: Internal Server Error (raise TypeError("...
0
votes
1answer
37 views

pset5 valgrind tests failed

I'm very close to completing pset5; all smiley faces except the Valgrind memory leak. I'm hoping someone can help find the problem. I am only leaking 112 bytes and have tried to fix the issue by ...
0
votes
1answer
32 views

How do you find the first digit of a long number?

I wrote the following code to try to find the first digit of a long number (this is for the CS50x "Credit" exercise), but it's not working. Any tips? // Conditions and relational operators #...
0
votes
1answer
22 views

CS50 - edge filter pset4

I'm working on the edge filter in pset4 in CS50. The code compiles but when checking the code with check50 I get multiple errors. Looking closer at the output of the error check the first row and last ...

1
2 3 4 5
15