Questions tagged [cs50x2020]

The tag has no usage guidance.

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

API key or look up function error in cs50 finance pset9?

I was working on the implementation of buy and trying to buy stocks when all of a sudden I began receiveing incorrect/invalid stock symbol for every stock symbol I tried(as if the stock symbol was not ...
0
votes
1answer
39 views

:( handles lack of key failed to execute program due to segmentation fault

The following piece of code I've written for pset2/caesar produces a "segmentation error" when there is a lack of key (when no command-line argument is provided). I don't know which line or ...
0
votes
0answers
38 views

pset2/caesar handles lack of key failed to execute program due to segmentation fault [duplicate]

#include <cs50.h> #include <math.h> #include <stdio.h> #include <string.h> int key(string input); int main(int argc, string argv[]) { int l = strlen(argv[1]); int ...
-1
votes
1answer
35 views

pset3 - plurality - failing check50 'print multiple winners' - but my own tests say it works, not sure what I'm missing

I'm not sure why my program is failing check50, when I run my own tests it does seem to print multiple winners, but check50 says it doesn't print multiple winners [removed solution code]
0
votes
1answer
17 views

Why is my recover code not giving any output?

I'm very confused why this code is not giving any output: Code: #include <stdio.h> #include <stdlib.h> #include <stdint.h> typedef uint8_t BYTE; long int findSize(char file_name[]) ...
0
votes
1answer
98 views

Pset1 Cash less comfortable - not running for 0.41 and 0.01

-- hi im running into a problem with my code. It's executed pretty well with many inputs except for 0.41 and 0.01. It didn't print out any answer but just ran indefinitely... #include <stdio.h> #...
0
votes
0answers
45 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
217 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 ...
1
vote
1answer
30 views

Making code neater: a way to reduce repeated logical operators?

For CS50 pset1 Credit I'm using repeated logical-OR operators (||) to work out the validity and card brand of a credit card number. When I evaluate the style of my code using style50 it says to insert ...
0
votes
1answer
130 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
3answers
306 views

PSET 5 Hash help

I started my load function without looking at any reference code (first time starting a pset this way) to give me an idea on how to implement my own version. I was mostly confident until I reached the ...
1
vote
1answer
28 views

CS50 recover (fclose giving segmentation fault)

found a few answers to the segmentation fault issue in CS50 recover while closing the file but I couldn't translate the answers to my issue: The last part: fclose(f); fclose(img); is resulting into ...
2
votes
2answers
204 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 ...
0
votes
1answer
184 views

PSet 6: DNA gives correct as well as wrong ouput

Problem Set 6: DNA gives output No Match No Match No Match No Match No Match No Match No Match No Match No Match No Match Lavender No Match No Match No Match No Match No Match No Match No Match No ...
0
votes
1answer
220 views

PSet5 case-insensitive using strcasecmp

Tried iteration over strlen and random constant variable but unable to solve: :( spell-checking is case-insensitive expected "MISSPELLED WOR...", not "MISSPELLED WOR..." Here is my full code: //...
0
votes
2answers
43 views

PSET4 recover. Why doesn't my counter increase?

Below is my working code but I've a question. If change my char filename[8] to char filename[7] the counter does not increase. Instead, I'll only have 2 output files: 000.jpg and 001.jpg, where 001....
0
votes
1answer
272 views

Pset2 Readability test fail "complex single sentence" Grade 9 instead of Grade 8

When using check50 or inputting the provided texts, my program passes all but one test; the "complex single sentence" test returns a Grade 9 instead of Grade 8 (Coleman-Liau index returns 8.785455 and ...
1
vote
1answer
287 views

bot50 invitation on me50

I found an email on my inbox saying "@bot50 has invited you to collaborate on the me50/MyGithubUsername repository" and I accepted the invitation. Is that something malicious?
0
votes
1answer
51 views

CS50 pset4 recover.c produces unsupported jpg images

Here is my code. Please help. #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <stdbool.h> #define BLOCK_SIZE 512 #define FILE_NAME_SIZE 8 typedef uint8_t ...
0
votes
2answers
241 views

PSET 4 Errors: where did I go wrong?

So after being stuck on this pset for overlooking tiny typos I have finally gotten it to compile but I received more errors then I would like to have. If anyone could tell me where I can find the ...
0
votes
1answer
12 views

it is about credit in pset 1 code (no error but doesn't work) it doesnt show amex or visa or mastercard just keeps prompting to enter again

#include<cs50.h> #include<stdio.h> int main(void) { long cc, wcc, d = 1; int sum = 0, n = 0, fd ,ftd; do { cc = get_long(" number : "); } while ( n < 0 ); ...
0
votes
2answers
63 views

PSET 1 Cash two inputs don't get appropriate value

I'm stuck trying to understand what's wrong with my code... When I check it I get this error message: :( input of 1.6 yields output of 7 expected exit code 0, not 1 But getting 7 coins for 1.6$ ...
0
votes
1answer
593 views

Problem Set 8 / Web Track - Finance (Redirect Error)

My functions seens to work fine, but when i have that redirect the user to the homepage (redirect("/")) the application crash and show the error message: 500 internal server error and I don't know if ...
0
votes
1answer
290 views

CS50 Blur issue

void blur(int height, int width, RGBTRIPLE image[height][width]) { RGBTRIPLE holder[height][width]; int red; int green; int blue; float counter; for (int i = 0; i < height; i++) { for (int j ...
0
votes
2answers
65 views

pset2 readability. cannot compile although int is declared and code is complete. could someone please look into?

#include<cs50.h> #include<stdio.h> #include<string.h> #include<ctype.h> #include<math.h> int main (void) { string text=get_string("text:\n"); // to count ...
0
votes
2answers
95 views

Pset1 Cash (in C) array increment error

Context; I'm trying to solve Cash by; Taking positive integer user input, saves as float "ch" for change. (this as an implementation detail) Create an array "coin_val" with coin value by descending ...
0
votes
1answer
1k views

pset3 Runoff help

My code compiles but the only functions that had no errors are the print_winner and eliminate functions. I have tried to solve the errors for the other functions with no luck. My errors with the ...
0
votes
1answer
654 views

Getting this error: invalid operands to binary expression ('int' and 'int (int)') in the below code on ps1 cash.c

#include <cs50.h> #include <stdio.h> #include <math.h> int biggestCoin (int num); int main (void){ float userinput; int changeOwed, coins; do { userinput = ...
0
votes
1answer
248 views

Problem Set 4 - Filter (Blur)

I know its pretty lame and uninspired to hard-code each and every special case of the blur function, but somehow it still refuses to pass most of check50's tests (aside from the middle and edge pixel ...
0
votes
1answer
56 views

2019-2020 Progression bar red beside finished

I've start the CS50 late 2019 and finish it last week. I'm in this case: "If you submitted Problem Sets 0 – 4 last year, resume your studies with Problem Set 3 in Week 3 then skip to Week 6 and ...
0
votes
1answer
291 views

Pset4 filter reverse issue

I am banging my head for the past hour on why this does not work. Basically, testing on the provided pictures, my reverse function does what it says on the tin. However, when I test it vs check50, ...
0
votes
1answer
93 views

PSET2 Caesar isdigit function works opposite way

I am currently at CS50x2020 PSET 2 Caesar "validating the key" and having issue with using the isdigit function. From what I understand from the programmer's manual, isdigit will return 0 if the input ...