Questions tagged [caesar]

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

68 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
1
vote
1answer
67 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) ...
1
vote
0answers
82 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 ...
0
votes
1answer
17 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 ...
0
votes
1answer
16 views

I've been trying to submit ceaser and it won't compile can someone help?

#include <stdio.h> #include <cs50.h> #include <math.h> #include <string.h> #include <ctype.h> #include <stdlib.h> //atoi ? bool is_valid_key( string s); // ...
0
votes
1answer
35 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
1answer
32 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
1answer
45 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
1answer
65 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 ...
0
votes
2answers
48 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
2answers
42 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 ...
0
votes
2answers
42 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
1answer
52 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
2answers
131 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
0answers
49 views

ciphertext and the plaintext,

Let's now use a modified Caesar Cipher where c = (p+3x) mod 26, where c and p are the ciphertext and the plaintext, respectively, and x is the key. How many distinct keys, producing distinct ...
0
votes
1answer
18 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> #...
0
votes
1answer
63 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
0answers
33 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 ...
0
votes
1answer
57 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 { ...
0
votes
1answer
642 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
1answer
65 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
0answers
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 ...
0
votes
0answers
32 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' ...
0
votes
1answer
136 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 ...
0
votes
0answers
90 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[]...
0
votes
2answers
68 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 ...
0
votes
0answers
94 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 ...
0
votes
1answer
39 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
2answers
765 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> #...
0
votes
1answer
99 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
1answer
266 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 '...
0
votes
1answer
85 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 ...
0
votes
1answer
178 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) { ...
0
votes
1answer
408 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 ...
0
votes
1answer
102 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" ...
0
votes
1answer
54 views

My pset2 caesar program keeps giving an output of 0, how to get to the ciphertext?

I came up with these lines of code to get from a character in the plaintext to a new character in the ciphertext. I keep getting an ouput of 0 everytime I run it, no matter which key I choose or which ...
0
votes
1answer
84 views

pset2 - caeser help

It seems I am getting the correct answers when caesar is run, but I am failing all of my check50 tests. Please help??? #include <stdio.h> #include <cs50.h> #include <...
0
votes
1answer
52 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 ...
0
votes
1answer
389 views

Undefined reference to “get_string” (pset2, ceasar)

My code isn't compiling. I'm getting "undefined reference to 'get_string'" I think there is an issue with the way i have contextualized the first part of my code, i.e., above the "for" loop. I'm not ...
0
votes
1answer
45 views

Caesar doesn't change plaintext?

Program copiles and runs but doesn't change anything to plaintext. #include <cs50.h> #include <stdio.h> #include <ctype.h> #include <string.h> int main (int argc, string ...
0
votes
1answer
1k views

about caesar,i'm having a segmentation fault

#include<stdio.h> #include<cs50.h> #include<string.h> #include<stdlib.h> #include<ctype.h> int main(int argc,string argv[]) { printf("%s",argv[1]); string k=argv[1]; ...
0
votes
1answer
47 views

Pset2 Caesar Hail dont know how to encrypt the plaintext

plz help me refine my code thx!! https://raw.githubusercontent.com/check50/davil3388/cs50/2017/fall/caesar/caesar.c?token=Aehv0R6qUjbNWPi_rOMKjS7ChP3tSlW1ks5aSK8MwA%3D%3D
0
votes
1answer
177 views

Caesar: How text[i] in (text[i] - 97) is getting converted to int?

The text[i] in (text[i] - 97) is getting converted to int when we have assigned string to it. //this part. all the others are int. How text[i] is assigning itself as int here?? if(islower(text[i])) ...
0
votes
1answer
38 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
2answers
2k views

CS50 week 2 Caesar(cipher printf question)

#include <stdio.h> #include <stdlib.h> #include <cs50.h> #include <ctype.h> #include <string.h> int main( int argc,string argv[]){ int k; if (argc == 2) { ...
0
votes
1answer
228 views

Problem with caesar cipher encryption

I'm trying to solve pset2 Cesar encryption.Everything seems fine and encryption is working but when I hit check50 I get errors: :( encrypts "a" as "b" using 1 as key expected prompt for input, ...
0
votes
1answer
125 views

Pset2 Caesar won't compile

My code won't compile and I can't tell why. All of the error messages I'm receiving are regarding my "for" statement and my use of the variable i. I also get an error message about my use of "string" ...
0
votes
1answer
68 views

Road block again!!! Caesar pset2

What does this mean?: ":( handles lack of argv1" My code passed all the checks except for this one.
0
votes
1answer
204 views

Pset2 Caesar variable problem

I can't figure out whats wrong. Here's my code: //argc and argv allow to for users to input data before the program runs. int main (int argc, string argv[]) { //Do-while loop to ensure user ...
0
votes
1answer
91 views

pset6-caesar. I get this error message

File "caesar.py", line 28, in for i in range (len (plaintext)): TypeError: object of type 'function' has no len() This is the relevant part of the code, I guess. If need be I can post the whole ...
0
votes
1answer
139 views

CS50 pset2 caesar

I am busy with CS50 pset2. I am trying to interpret the error message received: :( encrypts "BaRFoo" as "FeVJss" using 4 as key \ expected output, but not "ciphertext: FeVJss" My programme ...