Skip to main content

Questions tagged [caesar]

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

Filter by
Sorted by
Tagged with
5 votes
4 answers
8k views

How to handle the lack of argv[1] in caesar?

I think my program handles lack of argv[1] correctly, yet it fails check50's test. here my code: if ( argc != 2 ) printf ("usage : ./caesar + key \n"); return 1;
user avatar
0 votes
1 answer
168 views

Caesar code fails check50

I've gone through a lot of the questions and tried that but it still fails the check50. I'll put the output here. :) caesar.c exists :) caesar.c compiles :( encrypts "a" as "b" using 1 as key \ ...
Nocte Serpentis's user avatar
2 votes
1 answer
523 views

Caesar code only works correctly when I add a random printf statement

My Caesar code seems to be working correctly in this form: #include <cs50.h> #include <stdio.h> #include <string.h> // validates that the key is only numbers int validate_key(...
Vasilis D's user avatar
0 votes
1 answer
391 views

CS50 Problem Set 2 - Caesar check error- I am unsure what is incorrect?

Here is my code below: #include <cs50.h> #include <stdio.h> #include <string.h> //strln #include <ctype.h> //upper lower etc #include <stdlib.h> //atoi int main (...
SGee's user avatar
  • 5
0 votes
1 answer
112 views

I can't check my exercise (pset2, caesar)

I have a problem with ceasar. text of my code: #include <cs50.h> #include <stdio.h> #include <string.h> //desribe of values //int i - number of arguments //int n - lenght of ...
Alexander Lyapunov's user avatar
9 votes
4 answers
10k views

What's the point of the modulo operation in the Caesar cipher formula?

According to the problem set specification, the formula for encrypting a message using the Caesar cipher is: ci = (pi + k) % 26 I don't get why you need to do modulo 26. What does it even do here?
Xihai Luo's user avatar
  • 305
3 votes
1 answer
1k views

Why doesn't caesar pass check50 even though the output is correct?

I have solved caesar, but check50 is not recognizing my results as correct. :) caesar.c exists :) caesar.c compiles :( encrypts "a" as "b" using 1 as key \ expected output, but not "b" :( encrypts ...
crack64's user avatar
  • 35
1 vote
1 answer
47 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
1 vote
1 answer
188 views

Pset2 Caesar: extra letter printed at the end of ciphertext

I have test many cases and most of them are fine except the following one: ~/workspace/pset2/caesar/ $ ./caesar 2 plaintext: I love tea ciphertext: K nqxg vgcB Where does the extra letter "B" come ...
Han Tang's user avatar
  • 113
1 vote
3 answers
7k views

Segmentation fault (core dumped) in caesar

After starting caesar with an additional argument and providing the sentence that needs to be encrypted, the Terminal shows this response: jharvard@appliance (~/Dropbox/pset2): ./caesar 1 abcdef ...
Kotlet's user avatar
  • 101
1 vote
1 answer
462 views

Pset 2 Caesar doesnt output spaces correctly and more :(

Really having a hard time doing this caesar problem my cipher text is not taking spaces to account and when I type in ./caesar by itself it gives me a message like this: caesar.c:10:18: runtime ...
Roundabout's user avatar
1 vote
1 answer
54 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
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
95 views

pset2 caeser boolean returns

when running the code below with a command line ./caesartest 2, I get the false return 1, not the true, what is wrong? (I began having the trouble after including isdigit)... #include <cs50.h> #...
Samir-B's user avatar
  • 11
0 votes
0 answers
65 views

Please help, i keep hitting segmentation faults on this code

#include <stdio.h> #include <cs50.h> #include <ctype.h> #include <stdlib.h> #include <string.h> int main(int argc, string argv[]) { if ( argc > 2 || argc < 2 ) ...
Brenda's user avatar
  • 23
0 votes
2 answers
192 views

Caesar output extra characters in capitals only

My caesar code works well for lower case but adds extra characters for upper case even though I used the same strategy in coding. :( encrypts "BARFOO" as "EDUIRR" using 3 as a key \ expected output, ...
infojunkie's user avatar