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
44 views

Check50 problem with Readability

When I submit my readability code check50 says: Expected Output: Before Grade 1 Actual Output: Before Grade 1 Expected Output: Grade 16+ Actual Output: Grade 16+ Since my program outputs what is ...
0 votes
1 answer
81 views

Question CS50 2021 Caesar - where is the bug?

I'm currently struggling with a bug in caesar pset2. If i use check 50 everything is green except: :( encrypts "a" as "b" using 1 as key output not valid ASCII text :( ...
0 votes
1 answer
70 views

Caesar works as intended but check50 says it doesn't

I've tested all the possibilities where check50 says my code isn't working as intended and I always get the expected result. I can't seem to figure out what I did wrong. Here's check50: :) caesar.c ...
0 votes
1 answer
38 views

Can't check CAESAR pset2

I solved the Caesar problem and it works flawlessly. But I can not check it properly. The results are correct but ''' check50 cs50/problems/2021/x/caesar ''' says it is incorrect. If I view the ...
0 votes
1 answer
74 views

Having problems producung the correct result using the text extracts provided by CS%). I cant see where it goes wrong when finding the correct grade

CODE: #include <cs50.h> #include <stdio.h> #include <ctype.h> #include <string.h> #include <math.h> int main(void) { // DECLARE LETTER, WORD & SENTENCE COUNT int ...
0 votes
1 answer
3 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': /...
0 votes
1 answer
46 views

Hello everyone, i have a problem with my code for caesar

So when i run the following code in the caesar.c that is located in the caesar folder, it seems to run only for the very first character of the given plaintext and then the next characters are missing....
0 votes
1 answer
15 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 ...
0 votes
1 answer
70 views

PSet 2 -- Substitution set:

All the check50 inputs are working fine, apart from the one where the input is "The quick brown fox jumps over the lazy dog". In this case my code works fine till 'jumps' and after that the code doesn'...
0 votes
1 answer
26 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&...
0 votes
2 answers
61 views

substitution behaves randomly strange

I am working on the main part of the problem. The previous checks all pass ( checking if two arguments, if key is 26 lenght, if key is only alphabetical chars and if every char is only once). But the ...
0 votes
1 answer
22 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 ...
0 votes
1 answer
9 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> ...
0 votes
1 answer
94 views

why am i getting a non numeric key error? cs50 caesar

i have been trying to do this for a month and i am finaly down to my last error message when i run my check 50.the error message is :( handles non-numeric key timed out while waiting for program to ...
0 votes
1 answer
67 views

PSET2 caesar. I am having trouble checking to make sure that the key is an integer and that it has two arguments in the command line

#include <stdio.h> #include <cs50.h> #include <math.h> #include <stdlib.h> #include <ctype.h> #include <string.h> int main(int argc, string argv[]) { //are there ...
0 votes
1 answer
35 views

PSET2 Substitution: Trouble only in encrypts all alphabetic characters using DWUSXNPQKEGCZFJBTLYROHIAVM as key

so this is my code. All problems are compiled successfully except this one. The output is "Segmentation fault" this is my code: #include <stdio.h> #include <cs50.h> #include <...
0 votes
2 answers
43 views

Caesar project: error: redefinition of 'i'

#include<stdio.h> #include<cs50.h> #include<string.h> int main(void) { string name = get_string("Enter: "); printf("%s\n",name); int n = strlen(name); printf(&...
0 votes
1 answer
96 views

Pset2 Readability error: expected identifier or '('

I've been trying to compile this code but always get this error "error: expected identifier or '(' " for the line 13 (which is the first one starting with "for") COuld someone help ...
0 votes
2 answers
201 views

Caesar doesnt pass "non-numeric key" check

I've read all the other answers I can find about people having a similar problem, but mine doesn't seem to be the same issue. Everyone says to use isdigit first, then use atoi, which is what I've ...
0 votes
1 answer
34 views

What do I do if I get "too few arguments to function call"?

What do I do if I get "too few arguments to function call"? Here is my code: #include <cs50.h> #include <math.h> #include <stdio.h> int main(void) { // Declare and ...
0 votes
1 answer
47 views

Error message: 21:9: error: expected expression else

I keep getting the above error: #include <cs50.h> #include <ctype.h> #include <stdio.h> #include <string.h> int main (int argc, string argv[]) { if (argc != 2) { ...
0 votes
1 answer
33 views

Pset2 Readability error with "else" statement

readability.c:28:9: error: expected expression else: Shown above is the error I am getting. If anyone would point me to what exactly I am doing wrong. that would be great. Bellow, I will add my ...
0 votes
0 answers
22 views

Ciphertext is not working

#include <cs50.h> #include <stdio.h> #include <ctype.h> #include <string.h> #include <stdlib.h> int main(int argc, string argv[]) { //program can only run with one ...
0 votes
1 answer
87 views

Caesar Cipher - output not valid ASCII text

I am using character array and none of the test cases matches the result. Please help me find what is missing. :) caesar.c exists. :) caesar.c compiles. :( encrypts "a" as "b" ...
0 votes
2 answers
14 views

Readability - use of undeclared identifier "i"

I have already identified "i" in my code, but it kept showing me error that use of undeclared identifier "i". I am not really sure how to fix it. Would appreciate if you show me ...
0 votes
1 answer
163 views

PSet2 doesn't match with Gradebook

I started the course on the 7th of January of 2020. I've done PSet0 and PSet1 with no problem. Now I'm in the middle of PSet2. I've done Caesar and submitted it. It appears in my Gradebook. Now I've ...
0 votes
1 answer
77 views

Pset2 Readability Not Working

I need help in executing the program here. This is my program and when I execute it, it asks me for a text. I copy-pasted the first HOW TO TEST YOUR CODE "One fish. Two fish. Red fish. Blue fish.&...
0 votes
1 answer
120 views

MARIO!! just look over

what in the world is wrong with my code: #include <stdio.h> #include <cs50.h> int main(void) { int n; do { // prompt user for a number 0 to 23 n = get_int(); printf ...
0 votes
1 answer
149 views

Segmentation Fault while Debug50 returns an output

I've been struggling with Vigenere for a while now, and now that I "believe" I got to the point, I get a segmentation fault error when I run the program. Weird thing is that while I try to spot the ...
0 votes
2 answers
57 views

PSET2: Readability code giving wrong grades

My Readability code keeps on creating the outputs of the wrong grade when I try to execute it. When inputting the text, 'When he was nearly thirteen, my brother Jem got his arm badly broken at the ...
0 votes
1 answer
23 views

Caesar scoping. variable len not defined, yet it works

The code is following: #include <stdio.h> #include <cs50.h> #include <math.h> #include <string.h> #include <stdlib.h> #include <ctype.h> bool key_validity(string s)...
0 votes
1 answer
25 views

initials not accepted by auto check

I just can't figure out why check50 does not accept it #include <stdio.h> #include <cs50.h> void isUpperCase(char ch){ if (ch >= 'A' && ch <= 'Z') printf("%c\n", ch); ...
0 votes
1 answer
20 views

substitution question segmentation fault issue

I am doing the substitution question and I keep running into this segmentation fault issue but i do not understand what exactly is causing the memory access issue. once j=4, the memory fails to be ...
0 votes
1 answer
1k views

expected '(' after 'if' error

#include <cs50.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <ctype.h> int main (int argc, string argv[]) { if (xxx) { do this; ...
0 votes
1 answer
327 views

pset2 readability. im getting 8 instead of 7th gread

Anyone knows why i get this error? :) readability.c exists :) readability.c compiles :( handles single sentence with multiple words expected "Grade 7\n", not "Grade 8\n" :) handles punctuation ...
0 votes
1 answer
38 views

pset2 Readability: reading index being calculated incorrectly even though hard sentence, word and letter numbers are correct

The indexes come out sometimes too low,some times too high and I don't really understand why if the variable calculations come out right every time. Here's my code for it: //calculates average letters ...
0 votes
1 answer
27 views

cs50 caesar help

Hi everyone I'm having trouble with my code, it compiles just fine but when I go to do the plaintext to ciphertext it only shows 1-2 letters at a time instead of the whole word. Idk where could the ...
0 votes
1 answer
78 views

I can't get my Vigenere code to skip spaces and punctuation, I don't know why

#include <cs50.h> #include <ctype.h> #include <stdio.h> #include <string.h> int shift(char c); int main(int argc, string argv[]) { // Checks to make sure user enters ...
0 votes
1 answer
84 views

isdigit and isalpha only checks first character - pset2

I had my Caesar all set and was moving on to Vig when I did one more check and realized that isdigit was only checking the first character. "[blank]", "aaa", "3 3" would all get kicked back and "44" ...
0 votes
3 answers
281 views

pset2 initials video

I have figured out how to do some of this on my own, but I've spent over an hour just searching for the videos on the subject! I have no idea where the uppercase was introduced, or where pulling ...
0 votes
1 answer
53 views

pset2 - crack - array declaration not working

I feel stupid, why is not printing "ROFL" in this program? I am testing for the crack.c program: #include <stdio.h> #include <cs50.h> //int main (int argc, string argv[]) int main (int ...
0 votes
1 answer
22 views

Help with cipher text in Pset2 substitution

I think I am getting close on Pset2 substitution. But every time I run this code it outputs my ciphertext as void. There's obviously something wrong with my loops converting plaintext to ciphertext ...
0 votes
2 answers
98 views

Counting apostrophe

How do I count the character apostrophe ( ' ) in a sentence. When I tried: if (s[n] == (''') error message showed "expected expression". missing terminating ' character. Other characters counting ...
0 votes
1 answer
45 views

Operations with Strings and Integers

I do not get it with the correct conversion string-int in the exercises Initials and Caesar. It tried it with all different solutions and functions, but nothing worked;( Could someone help me please? ...
0 votes
1 answer
84 views

SZZ output for Vigenere

This seems to be a faq on this problem set, although I looked at all other answers that pertained to this problem, I have been unable to fix the error. I am having trouble with one check50 spec where ...
0 votes
1 answer
154 views

Cs50, cipher text not printing

When i run my code, everything seems to be fine apart from the printing of the ciphertext, and the code doesnt seem to be getting passed the for loop of the string length of plain. Any ideas? #...
0 votes
1 answer
42 views

problem with displaying encrypted characters

can someone please have a look at my code(portion where im trying to encrypt the pain text in the for loop) and let me know where im going wrong. my program does not display . here is a portion of my ...
0 votes
1 answer
30 views

I can't work out what is wrong with my code - I think I am not indexing into the key

#include <cs50.h> #include <ctype.h> #include <stdio.h> #include <string.h> int shift(char c); int main(int argc, string argv[]) { // Checks to make sure user enters ...
0 votes
0 answers
24 views

How do I return my array of chars in a function to a string in main()

I'm having difficulty implementing the two sections of code for the caesar pset. Individually I have made both my main() and my rotating algorithm caesar() work, but am having trouble combining them, ...
0 votes
1 answer
65 views

caesar program not printing plain text

I have made my caesar program, and when compiled it doesn't generate any errors. However, once I run the program with a valid command argument, and then input text, nothing is printed after. Here is ...

1
2 3 4 5
26