Questions tagged [caesar]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
22 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
1answer
13 views

clarification validating command line arg

thanks for the answer. I tried to use a for loop, like this, for (int i = 0; i <= argc; i++) { if (isalpha(*argv[1])) { printf ("Usage: ./caesar ...
0
votes
1answer
34 views

I get segmentation fault after this line and I don't know why

I get segmentation fault at this point in my code and I can't figure out why string convert(string text, int num_copy) { string new_index = NULL, answer; for (int j = 0; ; j ++) { if (isupper(text[...
0
votes
2answers
30 views

I keep getting segmentation fault and I don't know why

I'm trying to print the value of argv[1] to check if the program will run as expected. It compiles fine, but I keep getting 'segmentation fault' when the program runs. #include <cs50.h> #include ...
0
votes
3answers
67 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
2answers
33 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
36 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
56 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
2answers
33 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 ...
1
vote
1answer
36 views

I have “handles non-numeric key timed out while waiting for program to exit” problem inPset 2 and I can't solve it

here is my code: #include <cs50.h> #include <stdio.h> #include <string.h> #include <ctype.h> #include <math.h> #include <stdlib.h> int main(int argc, string argv[]...
0
votes
1answer
45 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
1answer
24 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
1answer
30 views

PSET2 Caesar (BARFOO/BaRFoo error)

Hi everyone and I'm sorry if this has been asked here, but I've spent hours online trying to figure out why only the mixed (upper and lower) tests failed. I don't know what I'm overlooking or missing ...
0
votes
1answer
55 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 ...
0
votes
1answer
90 views

Problem Set 2 - Caesar

I am very new to coding. Prior to starting CS50, I have had no experience in coding at all, so pardon me if my questions are trivial. I am trying to write some code for 'Caesar' in Problem Set 2 and ...
0
votes
1answer
25 views

getting segmentation error when I use check50

I am not very good at programming. I had some knowledge of C and now I have taken CS50 course. Been struggling with the problem Caesar. Below is what I have written: #include <stdio.h> #...
0
votes
1answer
32 views

Caesar fails Check50 due to final “\n”

My Caesar code fails the Check50. While it correctly ciphers the message, it appears that the final new line code is not seen by the Check50. I have tried to understand why for several days, to no ...
0
votes
1answer
44 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
1answer
49 views

Having problems with Pset2, argv[1]: program doesn't 'see' it

I'm having a problem with argv[]: the code doesn't seem to 'see' it!! With a key that's either too long or too short, the program behaves as expected (prints out error message, exits). But if I input ...
0
votes
2answers
101 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
1answer
46 views

My code for Caesar gets segmentation error when executed, but in debugger it works fine

I'm getting a segmentation error as soon as I execute this program. I've run it through the debugger and it works fine and outputs the correct ciphertext. There's gotta be something going on in the ...
0
votes
1answer
62 views

Check50 for caesar, pset2 returns an error “Not valid ASCII text” twice, even though it encrypts correctly for the same text used in check50

Okay, the code is given below (forgive me if there are too many comments!!). Please help!! Code: //the objective of the program is to create a simple encryption of the text inputted by the user with ...
0
votes
2answers
110 views

pset2 - Caesar. Code works but fails check50. Expected and actual output match

Sorry, I know this has been asked before but I have read all the answers and nothing works! Please help. ERRORS :) caesar.c exists. :) caesar.c compiles. :) encrypts "a" as "b" using 1 as key :( ...
0
votes
0answers
39 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
66 views

I have a segmentation fault in Caesar in pset 2

Okay, first time writing here and I am a complete noobie. The program compiles and I have run the debugger, and it seems that I have a segmentation fault which I have marked. Also, I have used a lot ...
0
votes
2answers
43 views

pset2 caesar - showing “output not valid ASCII text once”

#include <stdio.h> #include <cs50.h> #include <ctype.h> #include <string.h> #include <stdlib.h> int cypher(string k, char p); int main(int argc, string argv[]) { if ...
0
votes
1answer
14 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
47 views

Pset 2 - Caesar - Code accepts numbers with letters

My code accepts numbers with letters, e.g. 2x. When running check 50 I get this error 'handles non-numeric key, timed out while waiting for program to exit. Log running ./caesar 2x..' The code is not ...
0
votes
1answer
210 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
1answer
40 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
1answer
40 views

Caesar: Validating the key - stuck

I am stuck with Caesar, validating the key. Before i use the atoi function, I want to check if argv consists of digits. I watched the linear search movie but is is to cryptic for me. I have to ...
0
votes
1answer
74 views

Checking a string to see if it's an integer

I'm currently working on Caesar and I'm trying to go through each step in turn to complete it. As the problem set requires, I've written code that runs from the command line. The code below ...
0
votes
1answer
48 views

CS50 Ceaser Validating Key

Trust you are well, I apologize for asking a question that's been asked before but I've been stuck on this for a while without any luck and finally realized I need help. I've attached my code of CS50 ...
0
votes
1answer
44 views

Caesar 50 , no output!

I am writing code for caesar but when i am executing the program i am not getting any output and when i try to print integer values instead characters it is giving weird integer values, with this i ...
0
votes
1answer
64 views

Caesar - Problem set 2 - incorrect output

include // isalpha, isupper, islower - functions needed for caesar --- c = (p + k) %26 include // Check program is ran with only 1 command line arg. Check to make sure all characters are digits. ...
0
votes
0answers
32 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
0answers
29 views

Caesar (Pset2): When i print out ciphertext, some additional characters, that are not supposed to be part of the array, print out. How do i fix that? [duplicate]

// Receive plaintext string text = get_string("plaintext: "); int t = strlen(text); char ciphertext[t]; //Array assignment for (int i = 0; i < t; i++) { // Plaintext to Ciphertext ...
0
votes
1answer
50 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
419 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
146 views

Segmentation fault in caesar

I am returning a segmentation fault with this code. The argc portion of the code is function correctly if i enter too many arguments returning "1". If the correct number of arguments are entered I ...
0
votes
1answer
56 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
794 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
25 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
48 views

Pset 2 Caesar “Expected Expression” - If statement

For the Caesar pset, I am having trouble trying to fixing an expected expression error. for (int i = 0; i < int n = strlen(argv[1]); i++) { printf("test"); } The condition inside the for-...
0
votes
1answer
110 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
88 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
1answer
90 views

Problem with Pset2!

I'm really not sure why my code doesn't work for char's that are L, and when 20 is added to them on line 34. Appreciate the help for a beginning coder please:) int main(int argc, string argv[]) { //...
0
votes
1answer
110 views

PSET 2 Caesar - Errors when key is a large number

// Converts Plain Text to Cipher Text int key; int prompt(void); int enicpher(void); // Takes User Command Line Arguments as Key if criteria are met int main(int argc, string argv[]) { // Throws ...
0
votes
1answer
89 views

PS2 Caesar Algorithm

#include <stdio.h> #include <cs50.h> #include <string.h> #include <ctype.h> #include <stdlib.h> int main (int argc, string argv[]) { //Terminates if Command-line ...
0
votes
1answer
117 views

Caesar - Validating they Key

Hope you are doing well, a version of my question has already been asked and I went through some of those responses but it hasn’t helped so far. I am new to coding and working on the Caesar problem ...

1
2 3 4 5
8