Questions tagged [caesar]

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

Filter by
Sorted by
Tagged with
1
vote
2answers
29 views

I truly confused on why ceaser won't work,

#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
14 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
24 views

Getting a “seg fault” on Caesar, Pset2

This is my code for Ceasar (pset2) of cs50. Whenever I try to make the program, I get a control may reach end of non-void function Could you help me with this? #include <stdio.h> #include <...
0
votes
1answer
29 views

Caesar prints out the desired output but fails the check50

I managed to write the code for caesar and it presents the desired values as output. However, when I execute check50, apart from a smiley on all other points, this is what I get: :( handles non-...
0
votes
1answer
33 views

caesar pset 2 non-numeric key error even when it works well when i try it myself

Here is my code which works well even with non-numeric key. #include <stdio.h> #include <cs50.h> #include <stdlib.h> #include <ctype.h> #include <string.h> bool key_check(...
0
votes
1answer
22 views

Caesar Code Complies when I think it shouldn't

One of the lines of my code is this - if (isupper(plaintext[j])) { int cap_end = (plaintext[j] - (int) 'A' + atoi(argv[1]))%26 + (int) 'A'; printf("%c", (char) cap_end)...
0
votes
1answer
32 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 <...
0
votes
1answer
27 views

Trying to implement itoa function in pset2 caesar

While working on Caesar i realized i needed a function to convert an int to a string and searched online. The first one I came across was the itoa function but it turned out it wasn't a standard ...
0
votes
1answer
25 views

Segmentation Error while Using if Statement for Pset2 Caesar

I have been working on Caesar for some time now and tried to use different loops but I am getting Segmentation Errors. #include <stdio.h> #include <cs50.h> #include <stdlib.h> #...
0
votes
2answers
32 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 #...
0
votes
1answer
30 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
25 views

Having trouble identifying non-decimal digit in Caesar PSET 2

I'm working on Caesar from Problem Set 2. I have done the first step to check for a single command line argument, but I'm stuck on how to check the argument to see if any characters are non - decimal ...
0
votes
1answer
29 views

Why is it a segmentation fault when argc is 1 only i.e if I input “./caesar” only? It contains some other errors as well given in screenshot

My program perfectly encrypts texts if user gives a key or enters a wrong key such as an alphabet. But if argc is 1, then I incur a segmentation fault. I also incur a few other problems when I apply ...
0
votes
1answer
29 views

pset2 mathematical IF statement : attempt

i finnished my Mathematical IF statement concept. What i need now is bitwise on the first bit of INT. either (1 or 0) and (-1 or 1). i'm not Giving you the formula to my (MIF) statement because you ...
1
vote
1answer
48 views

Pset2 Caesar - Segmentation fault error

First off, I will show my code: int main(int argc, string argv[]) { if (argc != 2) { printf("Wrong command line arguments\n"); return 1; } else { ...
0
votes
1answer
44 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 problems caesar pset 2

0 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 ...
0
votes
1answer
43 views

Problem with Caesar and non-numeric keys

How do you check for an integer in Caesar? The only problem I have is that I am unable to handle a non-numeric key. I understand fully what is meant by non-numeric, however, I am having an extremely ...
0
votes
2answers
38 views

getting error on caesar

I keep getting an error on the last else idk what's wrong with that code. #include <cs50.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> ...
0
votes
1answer
62 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
36 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
60 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
57 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
106 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
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
40 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
67 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
37 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
105 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
53 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
31 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
40 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
83 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
105 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
39 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
39 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
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
1answer
54 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
126 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
52 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
90 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
153 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
48 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
94 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
50 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
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
70 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
413 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
57 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
52 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 ...

1
2 3 4 5
8