Skip to main content

Questions tagged [pset2-caesar]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
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, ...
coder12's user avatar
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 ...
Jeff's user avatar
  • 21
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
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 ...
Dubgee's user avatar
  • 3
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&...
user35553's user avatar
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 ...
Alexander Siewert's user avatar
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 & ...
user3853194's user avatar
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&...
Andrew Saad's user avatar
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 ...
Amanda Chan's user avatar
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 &...
maira's user avatar
  • 1
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.
Sumith's user avatar
  • 5
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 <...
aksharrastogi's user avatar
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(&...
tabacool's user avatar
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 ...
Schmorris's user avatar
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 +...
Amos Ting's user avatar
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 ...
Dre Johnson's user avatar
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)...
lehga's user avatar
  • 1
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 ...
Sanidhya Vijay's user avatar
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 ...
Sheikh Ameen's user avatar
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 : ...
VooDooDarkMagic's user avatar
-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 ...
Sefram Carlile's user avatar
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 ...
Hamster1303's user avatar
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 ...
vijay gopal's user avatar
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 <...
FoundABetterName's user avatar
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 #...
FoundABetterName's user avatar
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, ...
chlyde's user avatar
  • 1
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 = ...
Victória Ester's user avatar
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
Menna Azban's user avatar
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 ...
Avaneesh Tisgaonkar's user avatar
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 ...
Yash Patel's user avatar
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" ...
Reeman's user avatar
  • 3
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 ...
user29271's user avatar
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: ...
user29121's user avatar
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 ...
Chris Causey's user avatar
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 ...
Tom Gastall's user avatar
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 (...
Matthew's user avatar
  • 15
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 ...
Jay's user avatar
  • 1
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 ...
Pot Noodle's user avatar
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, ...
Sion Williams's user avatar
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 ...
Redwan Mahmud's user avatar
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 ...
bloomsdayforever's user avatar
0 votes
1 answer
94 views

Pset 2 caesar handles non-numeric key fail

Everything else in my program seems to run smoothly but I always get the problem of ":( Handles non-numeric key" but when I switch the atoi function with an isdigit function, it passes the handles non ...
E V's user avatar
  • 3
0 votes
3 answers
657 views

I'm getting an for error expected expression. What exactly I'm I doing wrong?

I mainly want my else statement to work, but it's not working. int main(int argc, string argv[]) { if (argc != 2) { printf("Usage: ./caesar key\n"); } else if (argc == 2) { for (int i = ...
Dave's user avatar
  • 23
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 &...
Mahindra Vijay's user avatar
0 votes
0 answers
34 views

caesa cypherr cs50 pset2

I am having some issues with my code, clang continues to say use of a undeclared identifier when I have identified the variable that I would like to use. Can some one help me with this issue. My code ...
Keith's user avatar
  • 15
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 ...
janecrager's user avatar
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 <...
Andrewoca's user avatar
0 votes
1 answer
23 views

Why does my code keep returning 1 with the error message even though I input a digit?

I am trying to complete the Caesar excercise on pset 2. My code compiles fine however it seems to give me me the output Usage: ./caesar key even though I input an int. Any help is much appreciated on ...
Andrewoca's user avatar
0 votes
1 answer
55 views

Pset2 - Ceasar - Non Void function error

I am currently working on pset2 - ceasar. I have written my code but for some reason I have getting an expected expression error, which itself not very explanatory as to what is wrong with my code and ...
Bilal Junaidy's user avatar
0 votes
1 answer
146 views

I am trying to create program for checking command line arguments?

Check that program was run with one command-line argument. Iterate over the provided argument to make sure all characters are digits. Convert that command-line argument from a string to an int. code :...
richa sharma's user avatar