Questions tagged [cs50x]

The tag has no usage guidance.

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

Memory error -Valgrind [duplicate]

I'm doing PSET4 SPELLER, My code is working properly but Valgrind is giving errors, I'm unable to figure out why so. valgrind 32 bytes in 1 blocks are still reachable in loss record 1 of 1 Re-...
0
votes
1answer
38 views

CS50 Pset1 credit

after 2 days and half i did it it's tricky at first but this problem made me understand loops and array much deeper , the question is my code is good as style and design ? any ideas should consider ...
0
votes
1answer
27 views

jpg's are not proper, mix of multiple images. Can anyone tell me whats wrong?“RECOVER”

here is my code while (fread(buffer, 512, 1, inptr) == 1) { if (buffer[0] == 0xff && buffer[1] == 0xd8 && buffer[2] == 0xff && (buffer[3] & 0xf0) == 0xe0) ...
0
votes
1answer
33 views

Validating the key in PSET2 caesar?

int main( int argc, string argv[]) { if(argc ==2) { for(int i = 0, n = strlen(argv[i]); i < n; i++) { if(isdigit(argv[1][i])) { ...
0
votes
1answer
21 views

CS50 pset3 i want to resize this image, code is working for some and not for others? Can anyone tell me whats the problem?

int n = atoi(argv[1]); // read infile's BITMAPFILEHEADER BITMAPFILEHEADER bf,bfR; fread(&bf, sizeof(BITMAPFILEHEADER), 1, inptr); bfR = bf; // read infile's BITMAPINFOHEADER BITMAPINFOHEADER bi,...
0
votes
1answer
38 views

CS50; PSet1; Don't know how to connect for loop with user's input + expected identifier or '(' error

I don't know how to properly connect user's input part and for-loop(which is incorrect) in this program. I was seeking for how to do this but didn't find anything useful. Here are my code: #include &...
0
votes
1answer
13 views

pset8 c$50 finance /buy - transactions RuntimeError: (sqlite3.OperationalError) near “''”: syntax error

I'm stuck on pset8 c$50 finance /buy: Form validation works properly but when i try to execute the INSERT INTO transactions table i get the following error: RuntimeError: (sqlite3.OperationalError) ...
0
votes
1answer
44 views

CS50 Mario Less Comfortable Printing Pyramid

I have been working on this problem for about 2 weeks. I can receive input from the user and print hashes based on the number the user entered. However, I can't print a right aligned pyramid made up ...
0
votes
1answer
38 views

cs50 pset 1 greedy algorithm

#include <cs50.h> #include <stdio.h> #include <math.h> int main(void) { float y; do { y = get_float("Change: "); } while (y < 0); printf("%f\n", y * 100); ...
0
votes
1answer
33 views

pset 7 survey: trying to redirect to /sheet returns invalid syntax error

For part of CS50's survey problem from pset7, I'm supposed to redirect from a route that checks if the user has entered in all the survey's fields / appends the values to a csv file --> a route that ...
0
votes
1answer
26 views

CS50 Recover image does not match

I have been working on this problem for a while but could never get it to work. Check50 says that the recovered image does not match. When I opened the recovered images manually, they are all blank. I ...
0
votes
1answer
36 views

CS50 Bleep Incorrect Output

I am encountering a problem in CS50 Bleep. When censoring the message, the censored message consists of only one * for the entire word, rather than the length of the word. Here is my code: from cs50 ...
0
votes
1answer
18 views

PSET 6: Sentimental [Mario.py(less)]: How exactly do I “reject input” in Python as specified in check50?

this is my first time posting on here and I'm trying to not break any rules but sorry if I do. So, I followed the specification to make mario.py ( they are the same ones for mario.c ) in Sentimental ...
0
votes
1answer
16 views

pset8 finance: Problem with calculaton for “/sell”

I'm implementing the "sell" function and have a problem with the calculation of the new value for "share" and "cash". Here is my code: @app.route("/sell", methods=["GET", "POST"]) @login_required ...
1
vote
1answer
29 views

html and CSS link do not work Homepage Problem

everyone. I am currently working on the CS50 pset5 homepage problem. I have encountered a problem in my code. The code needs to contain at least four different .html pages, and it should be possible ...
0
votes
2answers
17 views

Got into an unexpected error while compiling the code

#include<stdio.h> #include<cs50.h> int main(void) { string name = get_string("what is your name?\n"); printf("hello,%s\n",name); } When I compile the above code using command "...
0
votes
1answer
19 views

cs50 Recover segmenation fault

I am working on the CS50 Recover Problem and got stuck on the segmentation fault. #include <cs50.h> #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { ...
0
votes
2answers
30 views

CS50 Vigenere Incorrect Output

I am stuck on this problem for days, and I have no idea about where went wrong! When I typed in /vigenere ABC the ciphertext of HELLO just becomes HFN?Z. PLEASE HELP ME! #include <cs50.h> ...
0
votes
1answer
32 views

CS50 Vigenere Getting the correct result but unable to submit

I am getting the correct result from the CS50 Vigenere as long as argc does not equal to 1. When it does, it shows runtime error and therefore I am unable to submit this exercise. Can someone please ...
0
votes
1answer
17 views

CS50 Pset6: cash.py not returning number of coins used for change

Below is my code for pset6 of CS50, in which the user is prompted for an amount of change in the form of a float, which is converted into cents (e.g. 1.25->125), and the fewest coins needed to make ...
0
votes
0answers
28 views

CS50 Finance error - :( logging in as registered user succceeds (application raised an exception)

I would love to ask for your kind help please with a problem I'm facing with the CS50 Finance problem. This is the outcome I keep receiving: :) application.py exists :) application starts up :) ...
0
votes
0answers
24 views

CS50 Finance - Struggling when registered user try to login [duplicate]

I'm having a very hard time trying to figure out what might be wrong with my code in CS50 Finance problem. I keep getting this result from check50: :) application.py exists :) application starts up ...
0
votes
1answer
21 views

PSet3 helpers.c fails one of the checks

I'm working on the PSet3 Find problem. Here's my code for the sort and search functions: bool search(int value, int values[], int n) { if (value < 0) return false; else { ...
0
votes
1answer
82 views

How do I validate a key in Caesar?

I'm having difficulties in validation step in Caesar. My logic here is to pass through each digit and check if it is a number character and if not, abort. If they all are, it will convert each ...
1
vote
2answers
53 views

I don't know why check50 HATES ME?! mario.more

Here's my code for mario.more. [removed solution code] When i execute this code, it performs exactly how it should look according to Walkthrough: But when I run check50, the terminal goes like ...
0
votes
2answers
108 views

I am ABSOLUTELY STUCK! (mario less)

Ok, I have tried and have gotten a 60%. I need at least a 70% to pass. Please. Help. Me. Please. Tell. Me. What. Do. I. Do. I am done cash and now I'm stuck on this! Here is my code: #include <...
0
votes
1answer
51 views

It doesn't work?!!! (Mario less)

Ok so this is my code: #include <cs50.h> #include <stdio.h> int main(void) { int n; do { n = get_int("Height: "); } while (n <= 0 || n > 23); for (int i = 0; i <= n; i++) ...
0
votes
1answer
30 views

I need help with cash - again

Ok so this is my improved code: #include <stdio.h> #include <cs50.h> #include <math.h> int main (void) { float c; int a, n=0; do { c = get_float("Change: "); } while (...
0
votes
1answer
32 views

I need help. (pset 1 - cash) I don't get this!

So this is the code I have now: #include <stdio.h> #include <cs50.h> #include <math.h> int main (void) { float c; int i; do { c = get_float("Change: "); } while (c <...
0
votes
1answer
87 views

How to print out hashes in mario(less comfortable)? (2019)

Ok so this is my code I have right now: #include <cs50.h> #include <stdio.h> int get_positive_int(string prompt); int main(void) { int i = get_positive_int("Height: "); for (i = 0; i < ...
0
votes
1answer
85 views

pset6 bleep: Problem with difference between list and string

I assume that I have the following problem: I create a list for the banned words and although a list with the text input. Then I want to compare both list. But when I create the list of the user ...
0
votes
1answer
53 views

PSET3 - resize help

I have been trying to figure this out on my own for a long time. No success. Then I tried to look for online help but could not find specifically what I wanted. It's true that I found alternative ways ...
0
votes
1answer
88 views

Resize(less) How to store triple into an array?

I have been struggling with resize (less). I can't seem to make sense of how to put the value of triple that is being read into an array (rewrite method) Any help will be appreciated // iterate over ...
0
votes
1answer
15 views

Domain Name and IP address

I have some questions on Week 5 short lecture on Internet Primer, in particular on the host and ip address table that was being showed at 11.37 of the video. The questions are as follow: In the the ...
0
votes
1answer
21 views

Does CS50 IDE run SSI?

I'm on pset5, trying to make a homepage with multiple HTML files. I want all the files to share the same navigation bar heading, implementing this in a way so that I don't have to copy the same code ...
0
votes
1answer
38 views

Pset4 speller free() function not working

For my Pset4 Speller, the unload() function is not working. I have tracked the problem to the free() function not working, but cannot get further than that. Could someone offer me any pointers please? ...
0
votes
1answer
100 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 ...
0
votes
1answer
36 views

CS50 - Speller (Hashtable) - Misspelled all words

My program is misspelling all words in the texts. There is a problem somewhere in either load or check, but I just can't figure it out. Can you guys help me find the problems I am having in my program?...
0
votes
1answer
29 views

Pset4: Recover - Reach EOF to “early” aka. doesn't recognize beginning of new jpg

I am fighting with the recover challenge in pset4. Had some progress and was able to detect 20 images. But then my condition for finding EOF is true and the program stops. I think the problem is, ...
0
votes
1answer
239 views

CS50x 2019 PSET 7 Survey

With regard to Survey, the second problem in PSET 7, I am having trouble with populating /sheet with data. I have collected the data from the form on the first page, but I’m not sure how to pass the ...
0
votes
1answer
18 views

Adding a code block to perform operations on float

I am currently on PSET 1 Cash and have my program asking for the amount of change required, not accepting negative values and now I want to add a code block to start performing the operations on my ...
0
votes
1answer
19 views

Pset 5 speller - accessing node->next results causing problems with valgrind

As the title says, every time I access node->next and run valgrind, it says I have an 'invalid write size of 8'. When I run check50, I get all smileys except the last for the last check. I have tried ...
0
votes
0answers
55 views

pset4 speller - speller considers all the words as misspelled

i need help with my code . speller considers all words in text as misspelled . and i checked my code many times and i still don't know what's wrong . #include <ctype.h> #include <stdbool.h&...
0
votes
1answer
35 views

my crack.c actually works, but doesnt give away the key! Pset2

I am trying to figure out how to solve the crack problem from pset2, everything works fine with compiling but when I try to crack the hash from the example 50cI2vYkF0YU2 which is Zamayla's ...
0
votes
1answer
220 views

CS50 pset2 vigenere problem getting the shift

Problem with the shift value function ## Hi, Could anyone please take a look at the code below and help me figure out where it goes wrong. I think the problem is with the shift_value. The code ...
0
votes
1answer
31 views

cs50.sandbox doesn't see <cs50.h> library

I am passing the edX CS50 2019 course. I have a problem with making my first hello program. The system for some reasons doesn't see the library, so I cannot use the GetString function. Here is the ...
0
votes
1answer
14 views

PSET3 Revovery Problem: EOF logic

In the walkthrough video Zamyla says that EOF has size less than 512 bytes. I noticed that the value returned by fread when end of file is reached is 0. Is this because the last byte of last JPEG in ...
1
vote
1answer
56 views

CS50 Pset 1 mario soluce

I have sent my code for the pset of mario, he is working but i have only 55% and i dont know why ! I have search the soluce on the web to compare but didnt found ! Can someone look on my program to ...
0
votes
1answer
32 views

NEWB question mario pyramids

so doing the CS50 class. have to make pyramids of hashtags with separation in the middle, height determined by "h" inputted by user. for some reason stackexchange doesnt seem to let me write the ...
2
votes
1answer
104 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. ...