Cs50 Questions
Ad
Troubles with CS50's pset2 "substitution" output
I can't seem to understand what is the problem with my program. the assignment is cs50's "substitution" from problem set of week 2. the
Valid VISA: 4222222222222 outputted as invalid
When running my program through cs50's submit50 check, everything works besides validating 4222222222222 as visa
Why is my valid_triangle program from cs50 doesn't work?
I have a problem with this code as i can't seem to find the problem? here is the problem that i tried to solve: - declare and write a function
CS50 filter RGBTRIPLE notation
Question updated: in cs50's filter.c image is defined as rgbtriple(*image)[width] = calloc(height, width *
What is a node in C?
I'm working on cs50 pset5 speller, and in the lecture they introduce a new thing called nodes. what is a node? i didn't really understand what
Bug in CS50 Readability pset2
My code compiled correctly and i passed every test case except one. the bug occurs in the sentence- "in my younger and more
When trying to create a cipher, how do you go about changing the characters in a string to integers
What i am trying to ask is when you are coding a cipher and you are asking for user input. how would you go about changing the characters in the
Why is an incremental increase to an integer in C causing overflow?
I'm working through cs50 and am currently working on a small function to determine the winner(s) of an election. void
Vote function in Tideman (pset 3 of CS50)
I'm trying to deal with the vote function and there are 2 questions i'd like to seek for your help: in the vote function definition,
Will comparing string length before checking if string is the same yield me non-negligible speed increases for C?
Very new to programming in c so sorry if i have badly misunderstood something. i am currently doing the speller problem set from cs50 if anyone is
Ad
Segmentation fault in CS50 (2020) recovery program
I am trying to write a program that will recover deleted images from a file and write each of those images to their own seperate files. i've been
CS50x Caesar - Segmentation fault when inserting isalpha(argv[1])
For the cs50x problem caesar i have created a program that encrypts messages using caesar’s cipher. for this, the program must recognize
expected identifier (in C)
I am currently doing cs50 introduction to computer science: i started this code (written in c) where i have to code a pyramid based on what the
When making sepia filter, error message pops up, meaning? C
I attempted the next requested filter and again had issues. the code compiles for once but when running the program in sepia it gives me an error
CS50 recover doesn't output any images
I'm working on the recover program of the cs50 course. here are the instructions: implement your program in a file
Cs50 recover problem: file can't be opened
I'm working on the recover assignment of pset4 cs50, and i think i finished my code. but when i run it, it says: file cannot be opened. if i try
Cs50's Problem Set 4 - Filter Less - Reflection Function
I have written the function to reflect an images that were provided in the zip file as .bmps. upon some research, i've seen that many
Error: result of comparison of constant 255 with expression of type 'char' is always false
I'm working on cs50 pset4 recover, and it's going pretty well. but when i made the if statement that checks if that file is a jpeg, clang started
I have bytes in use at exit but can't seem to make out where exactly. (cs50, pset5)
I just completed the cs50 pset 5
Why is my program leaking memory in C despite using free() at some point in the program?
My speller program is working perfectly fine except for a memory leak that i can't seem to wrap my head around. i have already satisfied every
cs50 speller "unload" memory leak
My cs50 speller function finally works, but when entering it into check50, it says there is a memory error with valgrind. here is my unload
Ad
Cs50 pset4 filter grayscale round function problem
I'm working on cs50 pset4 filter(less comfortable)grayscale and i have to round the numbers if they are decimals. but for some reason, check50
Cs50 pset4 reflect image filter code problem
I'm working on the cs50 pset4 exercise filter, and i finished the grayscale filter and the sepia filter, and now i'm on the reflect filter. i'm
Cs50 sepia problem with converting image from normal to sepia
I'm working on a cs50 program called filter(less comfortable, week 4), and it has to transfer images from normal to sepia. it's working fine
My terminal freezes after running C program
what am i trying to do? i am trying to solve the
how to check to make sure that each character of the command line argument is a decimal digit (i.e., 0, 1, 2, etc.)
I'm a little stuck on part of a cs50 encryption exercise where we have to implement a program that encrypts messages using caesar’s cipher, in
CS50 Caesar segmentation fault explanation
I can compile this code with no issues, the idea right now is just to test that i can successfully enter the cipher key(command line argument)
Problem with functions in C (readability)
I am working on an exercise in cs50 pset2 readability, and i'm trying to count up how many sentences there are in a text. so far my code is
How to count the number of words and sentences per string in c?
Here are the instructions of an exercise that i have to solve for cs50 pset2 readability(copy pasted from the site): your program
My For loop counter is not increasing as expected
I'm trying to replace the jth value of the function's input string to '0' whenever the ith value of
CS50 Filter(less) blur function
I'm extremely new to cs and thought i would turn to the community for help. i've been stuck on the blur function of the filter (less) pset for 6+
Confusion with operator '!' in c
I've seen the operator ! being used in multiple places differently and i still don't get how it actually works. my basic
Ad
Box Blur simplified CS50
I am hoping someone can help me. i am having a really hard time with the box blur problem in pset4. i am trying to simplify the concept so i can
Implicit declaration of function of a declared prototype
I have this error code: helpers.c:56:13: warning: implicit declaration of function 'swap' is invalid in c99
Use of undeclared identifier happening to specific function
I have the following error code popping up: in file included from filter.c:5: ./helpers.h:16:27: error: use of
Trying to implement Luhn's Algorithm in C
Iam trying to implement luhn's algorithm in the c language to check credit card validity, for those who don't know... this is
What's wrong with my code? CS50 Pset2: Readability
1- i don't know what's wrong with my code, this is ## help ## readability cs50 pset2. 2- the problem seems to be in float grade
cs50 pset2 caesar, either getting segmentation fault or incompatible conversion
This is my code so far, for the caesar problem
I'm getting negative output from a do-while loop, when it's supposed to stop at 0
I'm building a program for the problem set 1 of cs50x called "cash" that is written in c. i don't know how to make the function
CS50 - PSet4 (Filter) - Blur
I'm running the following code void blur(int height, int width, rgbtriple image[height][width]) { for (int i = 0; i <
cs50 - pset 2 - substitution program
I was doing the cs50 pset 2 - substitution, where we have to encrypt the plaintext using the key given by the user in the command line,
Why is my code skipping over spaces and punctuation when shifting letters through the caesar cipher?
So my code for my caesar programming is shifting the letters with the key just fine, but it is not keeping the spaces or puncuation. for example,
CS50 Credit Problem is skipping "else if" part
I am really stuck here. the programm gives right answer to invald credit card numbers but never say if its visa, amex or mastercard. i need
Ad
CS50 tideman - :( lock_pairs skips final pair if it creates cycle
I'm new to stackoverflow and pretty new to programming. i'm working on the tideman problem for the cs50 course.
C error: function definition is not allowed here, i already put function above int main(void), erased brackets, error still persists
I'm trying to solve this cs50 problem titled credit and i'm new to coding so i really appreciate if you'll help me find what i typed wrong here.
Change letters according to a Key (Encryption)
I'm trying to encrypt a input from the user (variable text) by a cyphertext with a given key (variable argv[1]). where a is replaced by the first
Passing an array from a struct as an argument to a function
#include <cs50.h> #include <stdio.h> #include <string.h> #include <stdlib.h> typedef struct { int votes; }
Segmentation Error : Command Arguments (argv)
#include<stdio.h> #include <cs50.h> #include <string.h> #include <stdlib.h> #include <ctype.h> int main(int
CS50 Blur filter gave incorrect outputs with small test cases
I am writing the mean blur filter for the filter task in cs50 (more comfortable version). when i tested it with some my pictures, it seemed to
How "struct" members are indexed? How to access them correctly in C?
How the "candidate" stuct is indexed in the following code? when i try to print the last member(last index?) of the created
CS50 Pset4 Filter (less comfortable) blur function Algorithmic Issue
Info about this task when i try to implement
Can anyone tell me why im getting a Segmentation Fault (cs50 substitution)
In my program i get the errors that i controlled, but when i try to avoid those preset errors and enter what i want the user to enter, it returns
C : Function Declaration
#include <stdio.h> #include <cs50.h> #include <string.h> #include <ctype.h> int count_letters(string
cs50 pset4 - edge detection filter not working - sobel operator
The following code i have written has the purpose of detecting the edges in a pixel using the sobel operator. however, it fails all of the tests
Ad
cs50 src5 example webpage not responding
I am currently doing the cs50 web programing course an am trying out some of the examples from lecture 5. running the example with flask it opens
How to update my function so that there are always 10 markers on Google Maps regardless of zoom and view (Mashup used CS50)
This is the updated final code that i got it to work. i use the get.zoom and center.change to ensure that no matter the view of the
CS50 pset4 recover - Recovered image does not match
I have been trying to do this problem for at least a week now, and can't seem to understand where is the problem, i already checked everything in
While (true) forever loop expected body function error
I'm new here. i am trying to do a forever loop with while (true) but can't seem to get it working. i have tried iterations without
CS50 Web Programming - Postgres SQL error while importing books.csv file
In my postgres database, i have made a table books. inside books, i have 5 columns - id, title,
CS50: LIKE operator, variable substitution with % expansion
I am trying to get a query into a variable called results, in which i query the database to find the books with a title like the input from the
Words count JavaScript - For Loop
Updated: i realize that in c i initialized the word counter 1. (i've tried to delete the inquiry but i was not allowed) :/ in order to try
UndefinedBehaviorSanitizer on my CS50 Blur Filter
I cant seem to figure out why this error keep happening. i'm fairly new to coding and this program is supposed to blur an image using box blur but
How I can cause a program in C to print only one statement once it encounters a specific condition?
I have been trying to write a c program where the user inputs a command-line argument and the program checks if it is all number digits or not. if
Plurality, cs 50, Why printf function prints differently outside if statement?
I know it is not correct implementation for print_winner function (printf should be inside the if statment). however, i cannot figure out why
How to check for double characters in a string in C?
I am trying to implement a program for problem set 2 of cs50. my program must accept a single command-line argument and the key itself
Ad
Experimenting with Pointers in C
I'm new to coding and started my journey about a month ago. i just completed problem set 4 for cs50 but wanted to play around a bit with pointers.
Why am I getting errors?
I'm trying to create a program that accepts cmd line arguments to encipher a plaintext! the program must accept one cmd line argument after its
Improving for() loops with other options
I have the following code: void record_preferences(int ranks[]){ // update preferences given one
I keep running into a segmentation error that I can't seem to be able to fix
For a course i'm taking i'm supposed to create a program that creates a simple ciphertext from plaintext using a key that the user inputs as a
ERROR string variable is receiving 0x603270 besides an alphabetic value
When i type an text, like: "the quick brown fox.", as an input, the debugger shows the value from the variable text is: 0x603270
Exiting out of program with condition involving fread
I am working on a photo extraction program for a course i am taking. for this program, argv[1] is the name of the file from which i want to
How to wrap around alphabetically z to a and Z to A after shifting each letter by a number of places?
I am working on a code in which i shift each letter by one place, so (a) becomes (b) and (b) becomes (c) and so on. so far i managed to do that,
Need Feedback : Credit (Pset1- CS50x)
#include <stdio.h> #include <cs50.h> #include <math.h> int main(void) { long
Is it normal that my defined condition loop does not act like expected?
I just started the cs50 course given by harvard. i am currently working on the problem set 1 which is to validate a credit card number. how come
What is the difference between an iteration and a loop?
I am doing cs50 harvard university online and i'm on week 3 but while watching the video i noticed that i iterations and loops seem the same, as
Boolean Functions in C "control may reach end of non-void function" error
I'm always getting "control may reach end of non-void function" on the boolean function when compiling the code and don't know what's
Ad
How to put a group of changes to an array and then print all of them as one in C
I'm solving a coding problem currently. i must encipher a code and change words into other encoded words. i know i can check and print each
Why is this still counting spaces within a String?
I'm just starting to code and i need help figuring out why this loop counts spaces within a string. to my understanding, this code should
CS50 Problem Set 5 Speller: Valgrind issue - Conditional jump or move depends on uninitialised value(s)
I've run my program through check50 and get the following output: :) dictionary.c, dictionary.h, and makefile exist :) speller
How may I count the number of words in a paragraph? I keep miscounting
I am trying to code a program that count the number of letters, words, and sentences in a text. i may assume that a letter is any lowercase
Why is my Caesar solution (CS50) double-typing uppercase characters?
My program can correctly encrypt lowercase letters, but for uppercase the output will double-type characters. for example, if i put the input in
What is the difference between chars and strings?
I am working on cs50 coding exercise but i don't get strings and chars. i have problems with them cause i can't understand what they are. i don't
How to define a variable "N" type in C when N it is an input to C and its also defined by an input function( N will prompt the user for input)
I am still new to programming and very very new to c programming, so please pardon me if my question seems ridiculous. i am learning about
How to call a bool function in main?
I am trying to create a function by which i can check if the data entered match a triangle or not. i managed to do the function, but i am having a
CS50 Pset5, runs fine with large dictionary but seg faults on small dictionary
I am having some problems with pset 5 of the cs50 course. this is the speller problem. my code segfaults when i try to load the small
How to loop through a string and check if it matches current character of the same string in C?
I am a noob so please forgive me for being dumb... basically, say the key is 26 characters, composed of the letters of the alphabet with no
How can I print a variable size "string" in C using a for loop?
So i started learning c last week and i'm trying to write a very simple program that prints a pyramid of # characters depending on user input
Ad
Caesar segmentation fault in c language
I'm working on the second homework caesar of cs50. it seems most of my review is correct except the last one. i cannot handle the situation of
PSET5 Speller Segmentation Fault
// implements a dictionary's functionality #include <stdbool.h> #include <stdio.h> #include <strings.h> #include
My speller (cs50/pset5/speller) has a memory leak issue
I'm trying to run check50, but it says i have a memory leak issue. i ran help50 valgrind ./speller texts/cat.txt , and it says:
Segmentation error when altering a variable in an array
I'm trying to develop a cipher program that alters someones text input according to a string of 26 char's they can customise. the route i've
CS50 Luhn's Algorithm in C
I'm new to c and i'm doing cs50. i can't get my code to work. i'm almost positive the for statement is correct. the sum given by the for statement
Hash function precision issue
I'm writing a program that spell checks words, but my hash function is not returning the same number for the same words. my question is how
how to print full text in one line using for loop in c?
I am using the for loop to add one to each character in a string and print them out but when printing them each letter is formed on a new line, i
cs50 pset4 Recover - why does writing entire file to memory fail check50?
I'm working on recover and am wondering if there's
Can someone explain to me how this HASH FUNCTION works (also if they have another better option)?
I'm working on cs50's pset 5, speller. i need a hash function for a hash table that will efficiently store all of the words on the dictionary
how can i convert my alphabetical index back to Ascii code in C?
String plaintext = get_string("plaintext;"); for (size_t k = 0; k<strlen(plaintext); k++) { int n = atoi(argv[1]);
what's meant by converting an ASCII character to alphabetical index and how can i do that?
In caesar (cs50) it says that i need to convert an ascii character to alphabetical index in one of the steps. what does that mean? i saw a video
Ad
How do I count the number of sentences in C using ".", "?", "!"?
I'm fairly new to coding. i'm having trouble with my "countsentences" function. i compare the string to "." , "?" ,
Wrong results with variables operations in C
I am trying to write this code: #include <stdio.h> #include <cs50.h> #include <math.h> int main(void) {
Ad
Blog Categories
Ad