Skip to main content

Questions tagged [pset2-caesar]

The tag has no usage guidance.

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

pset2 - Cipher - Invalid Slug

I'm struggling to check50/submit50 for the caeser cipher wk2 pset for CS50. Can anyone please advise what mistake I'm making? Code as linked: https://pastebin.com/5B7tcaGg I'm attempting to use; ...
0 votes
1 answer
30 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
952 views

problem set 2 caesar check :( handles non-numeric key timed out while waiting for program to exit

I have gotten my code to work for the caesar problem in problem set 2. However, when i check through check50 I run into this error: :( handles non-numeric key timed out while waiting for program ...
0 votes
1 answer
37 views

i m getting segmentation fault in my code for cs50 caesar

#include <stdio.h> #include <cs50.h> #include <stdlib.h> #include <ctype.h> #include <string.h> int main(int argc, string argv[]) { //getting correct input for KEY ...
0 votes
1 answer
61 views

cs50 pset2 Caesar - Help doesn't compile

#include <cs50.h> #include <stdio.h> #include <string.h> #include <ctype.h> #include <stdlib.h> int main(int argc, string argv[]) { // check for correct arguments ...
0 votes
1 answer
54 views

pset2 caesar, I really dont know, its printing the first capital twice?

im stuck now, I cant see it. Its all working and ciphers correctly, but whenever the first index of plaintext is a capital, it seems to print it twice? I have gone through it line by line for ages ...
0 votes
1 answer
21 views

Caesar for pset2

#include <cs50.h> #include <ctype.h> #include <stdio.h> #include <string.h> #include <stdlib.h> string plain_text; string cipher_text; int key = 0; int main(int argc, ...
0 votes
1 answer
170 views

pset 2 caesar problems with if/else code, debug50 and help50 aren't working

I wrote my solution to pset2 caesar and it compiles and behaves as expected but doesn't pass the check50 test. Error is as follows: :) caesar.c exists. :) caesar.c compiles. :) encrypts "a" as "b" ...
0 votes
1 answer
119 views

My solution to Pset2's Caesar works but I only got 40% on it. Why?

I worked my way through Caesar as well as Vignere in PSet2. I got a score of 99% for Vignere but only 40% on Caesar, which is really strange as I worked off of Caesar for Vigenere.. If anyone could ...
0 votes
1 answer
42 views

pset2 mathematical IF statement : attempt

#include <stdio.h> #include <string.h> #include <string.h> #include <stdlib.h> #include <math.h> #include <ctype.h> #include <cs50.h> int main ( int argc, ...
0 votes
1 answer
168 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
2 answers
81 views

PSet2 Caesar - User Defined Function Issue

I'm a newbie with what seems to be a syntax issue in my user defined function. Currently my code --and the error is the following: ...the problem seems to be the semicolon at the end of line 39. But ...
0 votes
2 answers
164 views

How to invoke command line argument functions outside of main? caesar.c

Let us say I want to create a separate function for lines 11-25 (check comment for reference) in my code as a separate "argument checker" function. Something similar to how I have my decrypt ...
0 votes
1 answer
65 views

PSET2 Caesar help - Rotate function

I have been getting the error message "expected identifier" for line 65 of my code pointing to the isupper function below. I can't see what I am doing wrong and any help would be appreciated ...
1 vote
0 answers
434 views

How do you call a boolean function in main?

In problem set two it asks to use a separate function outside of main to determine if the string argv[1] has digits. I believe I've done this correctly in that function, but I'm struggling to call it ...
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' ...
0 votes
1 answer
489 views

Pset 2 Caesar - only digits function not outputting properly

This is my first post and I wanted to say thanks to everyone who has already answered this for others and is contributing/helping us noobs out. I really appreciate having the ability to go through ...
0 votes
1 answer
903 views

Stuck on PSet 2 Caesar - Checking the Key Step

I'm working through PSet 2: Caesar, and I'm stuck on the step called "Checking the key". The instructions read as follow: Checking the Key Now that your program is (hopefully!) accepting ...
0 votes
1 answer
60 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
216 views

pset 2 Segmentation fault (core dumped)

Here is my program caesar, pset 2. I don't know where it is going wrong. whenever I run it with input, Segmentation fault (core dumped) error appears on terminal. how to fix this? #include <stdio.h&...
0 votes
1 answer
63 views

encrypts "a" as "b" using 1 as key output not valid ASCII text

I have been trying to figure out what the issue is in my Caesar code. When I run check50, I see 2 errors - encrypts "a" as "b" using 1 as key output not valid ASCII text & ...
0 votes
1 answer
157 views

Why doesn't my Caesar code not return an output for the cipher text?

Can anyone help me out why my code won't return any cipher text, think it has something to do with the formula ci = (pi + k) % 26 I have done. Any help much appreciated. // Libraries #include <...
0 votes
1 answer
443 views

How to solve "error: expected expression" while doing Caesar.c

I'm trying to solve Caesar but i keep getting this error: caesar.c:37:20: error: expected expression s[i] = char(int(text[i]+k-97)%26+97); \\ the arrow points to the 'c' in char #include <ctype.h&...
0 votes
1 answer
29 views

How do I assign a variable to all possible values of another variable?

I hope my question was worded right but I'm trying to solved pset2 caesar and i don't understand how to print something only if all the possible values of a variable fit the condition. If I input &...
0 votes
1 answer
38 views

I'm getting segmentation error when I'm trying to rotate each character of the plaintext by 1. Please help

Here I'm posting a picture of the segment in which I am trying to rotate each character of the plaintext by 1 before proceeding to higher values of key.
0 votes
1 answer
404 views

I believe my code is right but it's not giving output and pops segmentation fault

This is my code for Caesar Pset2. The code must be doing right but it's broken somehow. #include <stdio.h> #include <math.h> #include <string.h> #include <ctype.h> #include <...
0 votes
1 answer
775 views

incompatible integer to pointer conversion initializing 'char *' with an expression of type 'int'

I keep getting this error when I try to compile my program: incompatible integer to pointer conversion initializing 'char *' with an expression of type 'int' { if (argc != 2) { printf(&...
0 votes
1 answer
29 views

Undeclared identifier error inCS50 Pset2 caeser

I keep getting 2 undeclared identifier errors on these respective lines line 48: printf("ciphertext:%c", ((p[n] - 65 + k) % 26) + 65); line 54: printf("ciphertext:%c", ((p[n] - 65 +...
0 votes
1 answer
46 views

PSET2 Getting segmentation error

Hello so I am doing PSET 2 Caesar and I tried to write a function to tell me if argv[1] is not a integer I want it to print the error message from the assignment. The problem is I'm very new with ...
0 votes
1 answer
27 views

Program compiles and produces required output in caesar from CS50 but segmentation fault due to lack of memory. What to do next?

My program compiles and produces the required ciphertext in caesar problem but when the input has too many characters, I get a segmentation fault after a specific number of ciphertext characters are ...
0 votes
1 answer
97 views

I'm stuck at PSet 2 Caesar Cipher: The alphabets don't follow my modulo 26. It goes beyond it, printing non-alphabetic characters

The crux is at the last part where I've commented "CONVERT PLAINTEXT TO CIPHERTEXT" The variable asciiValue holds the, well, the asciiValue of the enciphered character. As you can see, I've ...
-1 votes
1 answer
29 views

Can't get PSET2 Caesar to compile

I'm having trouble getting my version of Caesar to compile. It keeps saying: error: use of undeclared identifier 'n' for (int i = 0; n = strlen(unencrypted); i < n; i++) I thought maybe I was ...
0 votes
1 answer
48 views

How to print the output in Caesar(Pset2)?

here's my code #include <stdio.h> #include <cs50.h> #include <ctype.h> #include <string.h> #include <stdlib.h> int main(int argc, string argv[]) { // prints Usage : ...
1 vote
1 answer
56 views

Segmentation Fault while running caesar

I am facing a small problem while solving caesar (PSET2). I can make caesar but when I execute the program and provide a numerical command-line argument, I get back: Segmentation Fault, and the ...
0 votes
1 answer
47 views

Pset 2 - Caesar - segmentation fault when input is null

I recently started cs50 and I finished caesar after great difficulty. Everything is working when I run check50 except there is a segmentation error when the input is null. I did search a few forums ...
0 votes
1 answer
57 views

Errors in Caesar pset2 and Wrong Output

I am almost finished with Caesar only a couple of issues persist which I am unable to overcome Here is my code - #include <stdio.h> #include <cs50.h> #include <stdlib.h> #include <...
0 votes
2 answers
137 views

Caesar pset2 How to Reprompt user for Command Line Argument?

I have started working on Caesar and I am stuck with how to repromt user for a command line argument incase they input some wrong values. Here is the code i wrote and I can't find any apparent errors #...
0 votes
2 answers
37 views

What's wrong with my code? Pset2 caesar (check)

So my code is working, but when I check, this error appears on all criphertexts. string plaintext = get_string("plaintext: "); printf("criphertext: "); for (int i = 0, len = ...
1 vote
1 answer
417 views

cs50 problemset 2 caeser check50 command gives me this error : 'You seem to be missing these required files: caesar.c'

This error keeps appearing although I'm opening the correct directory! enter code here ~/ $ cd ~/pset2/caeser List item
1 vote
1 answer
1k views

:( handles lack of key or argv[1] failed to execute program due to segmentation fault

#include <stdio.h> #include <cs50.h> #include <string.h> #include <ctype.h> #include <math.h> #include <stdlib.h> int main(int argc, string ...
0 votes
2 answers
60 views

Question on Pset2 Caeser

I am a beginner to coding and a rising ninth grader. This is my code on the bottom and I ran check50 on it and everything was green but, I'm not sure if the code would be consider as "right" ...
0 votes
1 answer
32 views

validating command line argument

I'm doing caesar in pset 2 and it's working well when i enter ./caesar 1, or ./caesar a, or ./caesar 1 2, but when i try ./caesar 2h, it still runs the program. A couple of other people asked this ...
0 votes
3 answers
161 views

Why So Many Check50 Errors on Caesar? Results match expected output

Of the 11 Check50 checks, only 4 check out correct but when I run the code with the Check50 inputs, my outputs match the expected outputs, so why so many errors? Here is a link to my Check50 results: ...
0 votes
1 answer
751 views

Caesar Pset2 Handles non-numeric key :(

I am tearing my hair out on this exercise. I cannot get it to pass a non-numeric key. I've played around with the code for 2 weeks now. I can either get it to handle a numeric key or handle a lack of ...
0 votes
2 answers
78 views

pset 2 caesar -- bug that specifically lowercase letters with key more than 52 don't work -- everything else does

// ciphering for (int i = 0, n = strlen(plaintext); i < n; i++) { ... // lowercase if (plaintext[i] > '`' && plaintext[i] < '{') { if (...
0 votes
1 answer
59 views

Getting a segmentation fault when testing my code. I want to make sure the user is typing a correct input e.g. ./caesar 2 and not ./ caesar a

Trying to generate loop to check for alphabetical inputs in the user command argument. But i get a segmentation fault when testing it. error outcome. ~/Week_2/pset2/ $ ./caesar a Segmentation fault ...
0 votes
1 answer
44 views

Testing code to validate input using a parenthesis for cs50/pset 2/caesar.c I get error bash: syntax error near unexpected token `)'

Been struggling with this all morning and grateful for any help please! I'm aware that it's not the most elegant code but below weems to work OK with most invalid input that I've thrown at it so far, ...
0 votes
1 answer
633 views

I have the error of :( handles non numeric key - timed out while waiting for program to exit in Problem Set 2 Caesar

I have the error occured. May I know wheres the issue & where to add or remove the code? I'm new to the this. Thank You in advanced. #include <stdio.h> #include <stdlib.h> #include &...
0 votes
1 answer
38 views

Pset2 Caesar Memory Leak

I can't detect where I am leaking memory. Sometimes I get an unexpected output at the end of my array for cypher text and can't pass all test cases :(. Can someone point to me where I am wrong? Can ...
0 votes
1 answer
179 views

Caesar problem: Validating keys

I don't really know what went wrong here. I'm trying to test if the second word of the command line contain all digit. So I tried to check every character in argv[1] with the isdigit function by ...