Skip to main content

Questions tagged [caesar]

Caesar Cipher, one of the assignments in Problem Set 2.

83 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
1 vote
1 answer
51 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
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
1 vote
1 answer
71 views

Error in Caesar , can't fix . Need help

#include <stdio.h> #include <cs50.h> #include <string.h> #include <ctype.h> #include <stdlib.h> int main(int argc, string argv[]) { if (argc == 2) ...
Mahip's user avatar
  • 11
1 vote
0 answers
117 views

Printing extra characters in between the desired output characters for caesar

My caesar code is working well with one exception: the output includes extra characters. For example, if I enter the number 2 and then the message hi, what I get is jMkM instead of jk. As another ...
jamesb's user avatar
  • 11
0 votes
0 answers
19 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
0 votes
1 answer
54 views

Pset 2 Caesar: Problems with argv[] as a parameter

I have two main questions for my code. Please excuse me for my tideous code and for not using existing functions in the library, i.e. isdigit and strlen, as I didn't want to become dependent on them ...
pinkmonster's user avatar
0 votes
1 answer
58 views

caesar.c check problem

I finished my caesar ps but when I check it says that my code is not correct for example the said it didn't encrypt an a to a b if the key is 1 even though when I check it myself I see that the answer ...
Ibhi Yassine's user avatar
0 votes
1 answer
45 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
156 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, ...
krexaim's user avatar
0 votes
2 answers
228 views

check50 giving wrong output pset2 caesar

my code is giving output as expected but check50 says wrong output. here is my code and check50 log. #include <stdio.h> #include<cs50.h> #include<ctype.h> #include<string.h> #...
user35553's user avatar
0 votes
1 answer
58 views

PSET2 -CAESAR - compiler doesn't see the rest of program

i have a problem with this pset. My program compiles properly, but when i'm launching it with key, it stops before get_string... When i'm using the only_digits function which is commented in bottom of ...
Kuba Oleksa's user avatar
0 votes
1 answer
120 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 :( ...
bloodycoder's user avatar
0 votes
1 answer
496 views

How to rotate alphabetical characters by 26

#include<stdio.h> #include<ctype.h> #include<cs50.h> #include<string.h> int main(void) { string name = get_string("Enter: "); printf("Entered text by ...
Splendid Digital Solutions's user avatar
0 votes
2 answers
130 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(&...
Splendid Digital Solutions's user avatar
0 votes
1 answer
191 views

Caesar, trying to only accept digits help

I am trying to only accept digits. I turned Argv1 into an int with atoi, and used isdigit to confirm it is a digit being typed in. Why is it accepting both characters and digits?
Nicholas Dalman's user avatar
0 votes
0 answers
46 views

One last error in pset2 Caesar regarding key 65 (barfoo) - lost for how to fix!

I have read just about every question and answer to exist on the internet about this problem, rewatched lecture segments and walkthroughs, and done additional research on the functions used to try and ...
pickles_and_olives's user avatar
0 votes
1 answer
90 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 ...
ninjoi's user avatar
  • 1
0 votes
1 answer
67 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....
kostas's user avatar
  • 1
0 votes
3 answers
524 views

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

if (argv[1] == NULL) { printf("Usage: ./caesar key\n"); return(1); } this is the solution before the program received the first statement validate null
ramon chacon'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
111 views

:( handles lack of key failed to execute program due to segmentation fault

The following piece of code I've written for pset2/caesar produces a "segmentation error" when there is a lack of key (when no command-line argument is provided). I don't know which line or ...
Upanshu Lakhani's user avatar
0 votes
1 answer
37 views

Why do I get a segmentation fault? CS50 PSet2 - Caesar

Here is my code. #include <stdio.h> #include <math.h> #include <cs50.h> #include <string.h> #include <stdlib.h> int i = 0; int k = 0; string ciphertext; int main(int ...
Voices_'s user avatar
0 votes
1 answer
192 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 ...
Zoey Herbst'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
1 answer
114 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" ...
user7968702's user avatar
0 votes
1 answer
106 views

check50 in pset2

I won't post my code, because, as far as I could tell, it works fine, but I keep on getting this when I run check50 and I don't know know exactly what it means or how to fix it. My code runs perfectly ...
user29271'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
1 answer
64 views

Why the if statements don't work when I put them into loops? Caesar PSET2

Help, please. The program works fine until I want to add the loops and when I do that the if statements inside it won't work and it will just ask for the key and will output the same text as the input ...
DZV31's user avatar
  • 1
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
78 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 ...
wilburch's user avatar
0 votes
2 answers
247 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 ...
Brandon Zemel's user avatar
0 votes
1 answer
24 views

Command-line validation key

I cannot figure out why am I getting these results? I'm currently only trying to validate the Numeric Key when typing 20x as a command-line argument get Usage: ./caesar Key #include <cs50.h> #...
Laureano Jos Gutirrez Vallenil's user avatar
0 votes
1 answer
189 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? #...
anonymous'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
67 views

Hello! Could someone help me with problem set 2 caeser 2020, mistake is that problem accept non-numeric character

include include include include include int main(int argc, string argv[]) { int condition = true; for(int i = 0, n =(strlen(argv[1])); i < n; i++)// going through string { ...
Alisa Azimova's user avatar
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
0 answers
1k views

PSET2 Caesar : problem regarding non-numeric key

my code for Caesar works fine regarding the ciphering part but it won't pass the check50 because of the criteria "handles non-numeric key" and I have this message : "timed out while waiting for ...
Martinf's user avatar
0 votes
0 answers
74 views

pset2 caesar expected expression error

I can't understand this error. caesar.c:22:20: error: expected expression string p = get_string(); ^ /usr/include/cs50.h:109:53: note: expanded from macro 'get_string' ...
Ahmad ELZohairy's user avatar
0 votes
1 answer
486 views

Caesar pset2 - using isdigit(argv[1][i]) only looks at the first character

I have read through the other posts where you need to use argv[1][i] when using isdigit to avoid the error. It does eliminate the error, but it is only reading the first character and stops. I can ...
Toni's user avatar
  • 1
0 votes
0 answers
93 views

segmentation error in caesar, I am unable to understand why

Here is my code: #include <stdio.h> #include <cs50.h> #include <math.h> #include <string.h> #include <stdlib.h> #include <ctype.h> int main(int argc, string argv[]...
Musical_Ant's user avatar
0 votes
2 answers
121 views

Caesar - unexpected results - weird character added to cypher

My code seems to be working but when I enter only one or few characters in my plaintext, my cyphertext returns weird characters... I had a look at my code and try couple of solutions and I can see ...
Xavier LeVin's user avatar
0 votes
0 answers
145 views

Submit50 & Check50 not submitting most upto date version of pset

I've been attempting to submit my Caesar cipher solution to no avail; my first submit worked fine but then I noticed that my code was well full of bugs. So, I fixed it, and submitted again. Following ...
Douglas G. Wright III's user avatar
0 votes
1 answer
75 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) { ...
user11913821's user avatar
0 votes
2 answers
1k views

Caesar - Validating key using isdigit

I keep getting this error: caesar.c:17:13: error: subscript of pointer to function type 'int (int)' if (isdigit[i] == 0) This is my code: #include <cs50.h> #include <ctype.h> #...
user11913821's user avatar
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 ...
Anjali Radhakrishnan's user avatar
0 votes
1 answer
864 views

c:30:25: error: invalid operands to binary expression ('char *' and 'string' (aka 'char *'))

Hey guys could someone advice me on the flaws in the following line of code. I'm visited by the following error message: c:30:25: error: invalid operands to binary expression ('char *' and '...
Lim Dion's user avatar
0 votes
1 answer
99 views

Validation bug on caesar, repeating loop error for more than one digit key

After spending many hours on caesar, I have restarted from nothing several times and think my program is able to correctly validated the key given by the user. The problem is that my validation only ...
Hans's user avatar
  • 1
0 votes
1 answer
219 views

Ceasar pset2, checking number of command-line arguments

So I'm working on the first part of Caesar and this is what i have so far : #include <cs50.h> #include <stdio.h> int main (int argc, string argv[]) { if (argc == 1) { ...
Devika Desai's user avatar
0 votes
1 answer
480 views

Pset2 (Caesar). Runtime error: load of null pointer of type 'char'

Problem with segmentation. I can compile the program, but can't run. Questions about segmentation fault were asked many times, but I still don't know. I think problem with command-line argument — I ...
Nikita Kokorin's user avatar
0 votes
1 answer
122 views

PSET 2 ----CAESAR

I am struggling in Caesar in Pset2. I am not being able to understand what is the function of argc and from where will the code pickup alphabets? That is, how will the software understand that "b" ...
Padma's user avatar
  • 11