Questions tagged [pset2]

The problem set for Week 2 continues with the C programming language used in problem set 1.

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

my Pset 2 Readability is getting the wrong grade level

What am I doing wrong?! When I check my code with check50, I get this: :( handles questions in passage expected "Grade 2\n", not "Grade 3\n" So far, I haven't been able to fix ...
OnAnd17's user avatar
0 votes
1 answer
13 views

Problem set 2, substitution -> I don't get why check50 shows that my output is incorrect

#include <cs50.h> #include <ctype.h> #include <math.h> #include <stdio.h> #include <string.h> string cipherText(string key, string text); bool checkKey(string key); int ...
NawafBRQ's user avatar
0 votes
0 answers
13 views

My cs50 prset2 caesar project rfused to compile,

My cs50 pset2 caesar project refused to compile, what could be the problem. Says can't run until frown turn upside down.
Donald Udofia's user avatar
1 vote
1 answer
35 views

PSET 2 Caesar : help part 3 : ciphertext rotating correctly but not printing out

*Edited to include the latest changes in the code. Can someone help me spot the problem with my code? Below are the results from check50 and the code itself. TIA!! Here is the prior question: PSET 2 ...
AmyG's user avatar
  • 41
1 vote
1 answer
39 views

PSET 2 Caesar : help debugging caesar : continued #2

I'm looking for some (more) help trying to figure out caesar. I finally got it to compile but it's not working properly. When I run check50, it looks like there are two main issues - one, it's not ...
AmyG's user avatar
  • 41
1 vote
1 answer
33 views

help with Caesar problem from Pset2

EDIT: Here is the new "only_digits" function that I'm struggling with: bool only_digits(string s) { for (int i = 0, j = strlen(s); i < j; i++) { if isdigit(s[i]) { ...
AmyG's user avatar
  • 41
0 votes
1 answer
27 views

help with debugging readability from Pset2

I'm looking for some help with the readability problem from problem set 2. When I run debug50, I'm getting an error message for the text (see image). It seems that the body of the text is not being ...
AmyG's user avatar
  • 41
1 vote
2 answers
75 views

Problem Set 2 (Scrabble) / Variable Scope

Could you please help me find out about variable scope? Below is a program for the CS50 Scrabble assignment. I initialized score1 = 0, score2 = 0 atop. I thought since they are global variables, when ...
Yuya Ito's user avatar
0 votes
0 answers
11 views

Hey So I am doing the cs50 Problem Set 2 and im on the readability part and I am confused

I ran the check 50 but I got all of them right except just one and I cant figure out why it isnt right. "There are more things in Heaven and Earth, Horatio, than are dreamt of in your philosophy.&...
EthanJ's user avatar
  • 1
0 votes
1 answer
29 views

Issues with readability functions

I am having difficulty getting past creating the first function of my code, line 61. I have tried many different variations and I suspect that I am just not understanding a basic concept of the ...
Jeff's user avatar
  • 21
0 votes
1 answer
300 views

cs50 Problem set 2: camelCase

I'm trying to make the "camelCase" problem but i'm stuck. I don't understand how to print a _ when there is a uppercase letter in the input. Could you give me some tips? This is the code ...
Zeger Bleyen's user avatar
0 votes
2 answers
23 views

psets2/scrabble.c, In pset2, scrabble im running into an error incompatible comparison between type int and char

How does [POINTS[word[i]] work, I don't seem to get it, somehow I got it to work, but many times it is showing incompatible comparison between type int and char.
WickleTim's user avatar
0 votes
0 answers
9 views

cs50 pset2 crack

i have completed all the previous pset before crack without much trouble. i am not clear on how to link argv[1] with password and not clear either on what loop to use. neested loop or normal loops of ...
Trex Vanga's user avatar
0 votes
1 answer
25 views

Getting " error: declaration shadows a local variable" but i don't know why

int wordsize = atoi(argv[1]); int status[wordsize]; for (int b = 0, wordsize < b; b++) { status[b] = 0; } The error happens specifically at the word "wordsize" in the for loop. I'm ...
Harr's user avatar
  • 35
0 votes
1 answer
14 views

Getting "error: expected identifier or '('" error and I don't know why

char rotate(char c, int n); { int upper[] = {65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90}; int lower[] = {97, 98, 99, 100, 101, 102, 103, 104,...
Harr's user avatar
  • 35
1 vote
1 answer
529 views

Getting the error: non-void function does not return a value in all control paths [-Werror,-Wreturn-type] and i don't know why

#include <cs50.h> #include <stdio.h> #include <ctype.h> #include <string.h> #include <math.h> bool only_digits(string s); int main(int argc, string argv[]) { if (...
Harr's user avatar
  • 35
0 votes
2 answers
223 views

Getting "using the result of an assignment as a condition without parentheses" error and i don't know why

for (int i = 0; n = strlen(argv[1]); i < n; i++) { if (isdigit(argv[1][i])) { return 0; } else { printf("Usage: ./caesar key\...
Harr's user avatar
  • 35
0 votes
0 answers
277 views

I was solving the problem set 2 bulbs. I dont seem to understand why the values of both string variables "text" and "s" are changing when I run debug

lines from my code are: #include <cs50.h> #include <stdio.h> #include <string.h> #include <math.h> const int BITS_IN_BYTE = 8; void print_bulb(int bit); int main(void) { ...
Hasan Shahid's user avatar
0 votes
1 answer
22 views

PSET 2 - Substitution - incompatible integer to pointer conversion using strstr function

I am doing PSET 2 - Substitution and am trying to implement a check for every character of the key to be unique. For that I create a helper array key_check, fill it with letters from the key one by ...
zendynar's user avatar
0 votes
0 answers
70 views

PSET2 : bulbs works fine in my terminal but shows bunch error while using check 50

I have coded this problem and executed in my terminal just fine .But when I use check50 to see if there's wrong it tells me that my output is wrong or there's no output even though in terminal its ...
Fayek Ahmed Rahat's user avatar
0 votes
2 answers
25 views

PSet2, Substitution, Unexpected Output - Nested FOR loops producing repeat iterations

I've tried to figure out how an iteration could repeat itself. Iterations 1 and 4 seem to repeat. I've left in my debugging printf lines so you can see how these iterations in my nested FOR loops are ...
fawkeskc's user avatar
1 vote
0 answers
1k views

pset2 - Bulbs - reversing array turns out wrong

I managed to make the right sequence of binary code (in reverse). Next, I do a for loop for reversing it, but it prints out wrong. I have no idea what happens, as the original array is correct, ...
yogmel's user avatar
  • 11
0 votes
2 answers
266 views

pset2 bulbs - getting array out of while loop

I'm working on the pset2 Bulbs problem and I've come to a place where I don't know what to do next. This code takes user text input and converts it to ascii; I can see that the array is being filled ...
mdc690's user avatar
  • 1
0 votes
1 answer
298 views

Error in problem set 2 coke

I completed the task in the problem. When I execute the check50 and I get an error that an output of 50 was not found when the amount entered was 30 but when I check this manually, my code gives an ...
Muhammad Mustafa's user avatar
1 vote
3 answers
2k views

Update to no-vowels: problem returning function result to main(): strange behaviour in CS50 workspace

UPDATE: After posing my original question (please see below), I learned more about variable scope, memory management, etc. I went with the straightforward solution of defining a variable in main(), ...
skytwosea's user avatar
  • 111
0 votes
1 answer
193 views

why does check50 keep telling me this?

I'm doing the "wordle" game from problem set 2 and and I have to verify that the guess has the correct length. It's working perfectly fine when I'm testing it, but check50 keeps telling me ...
spacemonkey's user avatar
1 vote
0 answers
108 views

CS50P Error in pset2 (Coke Machine)

I'm done with my coke machine assignment but now I'm trying to run here in codespace but getting this error, so how am I supposed to fix this? $ python3 coke.py python3: can't open file '/workspaces/...
Ritam Debnath's user avatar
0 votes
1 answer
64 views

substitution - my code passes all tests manually, but not check50

My code for substitution appears externally to be working correctly. It takes the key as an argument and prompts the user for the plaintext message. Both uppercase and lowercase keys work, and a ...
578574's user avatar
  • 1
0 votes
1 answer
17 views

PSET 2 segmentation fault

#include <cs50.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> int main(int argc, string argv[]) { //making sure the program was run ...
Selim Allen's user avatar
0 votes
1 answer
281 views

Lab 2:scrabble compute score function

I'm currently working on scrabble and I'm unsure how to go about making 'word' in line with POINTS[], so they match and have the same values for letters. This is the code I have so far, only recently ...
Robbie's user avatar
  • 5
0 votes
1 answer
38 views

pset2 substitution - handles multiple duplicate characters timeout

One last issue with my Substitution code. I keep getting the following error when I run check50: :( handles multiple duplicate characters in key timed out while waiting for program to exit My solution ...
Joseph J Filoramo's user avatar
0 votes
1 answer
45 views

pset2 substitution, segmentation fault

So my code for pset2 Substitution works about 99% correctly. When I ran check50, I realized that there is still an issue if the user does not type the key right after the program name at the command ...
Joseph J Filoramo's user avatar
0 votes
1 answer
21 views

pset 2 Substitution - extra char(s) in output

So I’ve figured out 99% of the code for the substitution problem. My plaintext input is being output correctly, with the correct enciphered letters and the correct case. However, I keep getting extra ...
Joseph J Filoramo's user avatar
0 votes
1 answer
39 views

why I have additonal output for caesar program?

I have below code written and majority of code is working, but when do check CS50, I have additional output if crypt "a" using k=1 #include <cs50.h> #include <stdio.h> #include &...
Eat个apple's user avatar
0 votes
1 answer
25 views

i cannot see what is wrong but each time i type an input i get the answer in negative numbers aka "before grade 1"

#include <cs50.h> #include <stdio.h> #include <ctype.h> #include <string.h> #include <math.h> int count_letters(string text); int count_words(string text); int ...
Bushra Mogareb's user avatar
0 votes
1 answer
87 views

pset2 - caesar : output is providing extra symbols after specific input cases

If someone has the time to explain to me how I can fix my code that would be greatly appreciated! Thanks :) Problems that I need help with: 1 - Program needs to accept single character inputs like 'a' ...
karlares's user avatar
0 votes
1 answer
34 views

pset2 readability test not calculating correct grade

I believe I've written the readability.c program correctly to count letters, words, and sentences based on readability prompt and calculate the grade index. But whenever I test the grade index, I'm ...
karlares's user avatar
0 votes
1 answer
19 views

Readability can't compile. Error : expected '(' after 'if'

#include <cs50.h> #include <stdio.h> #include <ctype.h> #include <string.h> #include <math.h> int main(void) { //prompt user for a string string text = ...
Alexandra Bartee's user avatar
0 votes
1 answer
502 views

cs50 pset2 substitution

hey i think my code is correct, ive compiled it and tested it. check50 is not passing it. the error messages and my code is below. can someone please help? :( encrypts "This is CS50" as &...
yosef's user avatar
  • 5
0 votes
1 answer
85 views

Segmentation error on isdigit function

Been looking for answers to this, but having a lot of trouble. I am receiving a segfault that seems to be coming from the isdigit line, though I'm not sure what is happening to argv[1] to cause the ...
Josh Schaeffer's user avatar
0 votes
1 answer
18 views

Can't print/populate a string in C

In PSET2 Substitution, to display the results, I'm initializing an empty string with: char cyphertext[] = {'\0'}; Populating it with: // makes the substitution for (int i = 0; text[i] != 0 ; ...
Amanda Alexandre's user avatar
0 votes
1 answer
81 views

PSET 2 Readability: undefined reference to `count_letters'

I'm receiving the error: /usr/bin/ld: /tmp/readability-1786f7.o: in function main': /workspaces/109105972/readability/readability.c:19: undefined reference to count_letters' clang: error: linker ...
Jaron Haberstroh's user avatar
0 votes
1 answer
107 views

CS50P - One check keep failing in PSET2

def main(): user_input = input("Input: ") print(f"Output: {twttr(user_input)}") def twttr(user_input): vowels = ["a", "e", "i", "o&...
kenevarle's user avatar
0 votes
2 answers
80 views

error: conflicting types for 'caesar_crypt'

I declare this function at the start of my C file: #include <ctype.h> #include <cs50.h> #include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> ...
David S's user avatar
  • 103
0 votes
1 answer
40 views

p2 substitution i have no idea how to return multiple value from same variable in a function since c doesnt take variable array length

#include <stdio.h> #include <string.h> #include <math.h> #include <ctype.h> int converter(string plaintext,string text ); int main(int argc, string argv[]) { string code= ...
ibrahim's user avatar
0 votes
1 answer
175 views

CS50 Pset2 Substitution "expected prompt for input, found none"

When I run the code manually, everything works fine: [snipped out code] { if (isalpha(argv[1][i])) { //Check that each character is only ...
jiayou's user avatar
  • 17
0 votes
1 answer
325 views

Use of bool in PSET2

So i'm trying to approach this pset using functions more than i have in previous attempts. the hints suggested to use bool to check if key is valid. my code compiles and all the rest of the parts ...
tsull's user avatar
  • 1
0 votes
1 answer
41 views

Error when calling seconnd function - expected expression

I'm trying to call my encryption function and am getting an undeclared identifier error. Not sure where i'm going wrong. Code: #include <cs50.h> #include <stdio.h> #include <ctype.h> ...
tsull's user avatar
  • 1
0 votes
1 answer
842 views

CS50 Readability solution unsolvable to me

I coded this solution myself, but I really can't figure out where I did wrong, I've spent days on this, and I would really appreciate any help!! Please, 😭 #include <cs50.h> #include <stdio.h&...
az ab's user avatar
  • 1
0 votes
1 answer
13 views

PSET2 "linker command failed with exit code 1"

So I was working on the Caesars problem trying to check that every character in argv[1] is a digit when i get this error trying to compile it: `/usr/bin/ld: /tmp/caesar-d6b46b.o: in function 'main': /...
Sebastián Vera's user avatar

1
2 3 4 5
27