Questions tagged [pset2-caesar]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
14 views

PSET2 Getting segmentation error

Hello so I am doing PSET 2 Caesar and I tried to write a function to tell me if argv[1] is not a integer I want it to print the error message from the assignment. The problem is I'm very new with ...
0
votes
1answer
13 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)...
0
votes
1answer
18 views

Program compiles and produces required output in caesar from CS50 but segmentation fault due to lack of memory. What to do next?

My program compiles and produces the required ciphertext in caesar problem but when the input has too many characters, I get a segmentation fault after a specific number of ciphertext characters are ...
0
votes
1answer
33 views

I'm stuck at PSet 2 Caesar Cipher: The alphabets don't follow my modulo 26. It goes beyond it, printing non-alphabetic characters

The crux is at the last part where I've commented "CONVERT PLAINTEXT TO CIPHERTEXT" The variable asciiValue holds the, well, the asciiValue of the enciphered character. As you can see, I've ...
0
votes
1answer
18 views

How to print the output in Caesar(Pset2)?

here's my code #include <stdio.h> #include <cs50.h> #include <ctype.h> #include <string.h> #include <stdlib.h> int main(int argc, string argv[]) { // prints Usage : ...
0
votes
1answer
23 views

Can't get PSET2 Caesar to compile

I'm having trouble getting my version of Caesar to compile. It keeps saying: error: use of undeclared identifier 'n' for (int i = 0; n = strlen(unencrypted); i < n; i++) I thought maybe I was ...
1
vote
1answer
28 views

Segmentation Fault while running caesar

I am facing a small problem while solving caesar (PSET2). I can make caesar but when I execute the program and provide a numerical command-line argument, I get back: Segmentation Fault, and the ...
0
votes
1answer
18 views

Pset 2 - Caesar - segmentation fault when input is null

I recently started cs50 and I finished caesar after great difficulty. Everything is working when I run check50 except there is a segmentation error when the input is null. I did search a few forums ...
0
votes
1answer
42 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
2answers
39 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
34 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
2answers
29 views

What's wrong with my code? Pset2 caesar (check)

So my code is working, but when I check, this error appears on all criphertexts. string plaintext = get_string("plaintext: "); printf("criphertext: "); for (int i = 0, len = ...
1
vote
1answer
63 views

cs50 problemset 2 caeser check50 command gives me this error : 'You seem to be missing these required files: caesar.c'

This error keeps appearing although I'm opening the correct directory! enter code here ~/ $ cd ~/pset2/caeser List item
0
votes
1answer
66 views

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

#include <stdio.h> #include <cs50.h> #include <string.h> #include <ctype.h> #include <math.h> #include <stdlib.h> int main(int argc, string ...
0
votes
1answer
27 views

i m getting segmentation fault in my code for cs50 caesar

#include <stdio.h> #include <cs50.h> #include <stdlib.h> #include <ctype.h> #include <string.h> int main(int argc, string argv[]) { //getting correct input for KEY ...
0
votes
2answers
43 views

Question on Pset2 Caeser

I am a beginner to coding and a rising ninth grader. This is my code on the bottom and I ran check50 on it and everything was green but, I'm not sure if the code would be consider as "right" ...
0
votes
1answer
23 views

validating command line argument

I'm doing caesar in pset 2 and it's working well when i enter ./caesar 1, or ./caesar a, or ./caesar 1 2, but when i try ./caesar 2h, it still runs the program. A couple of other people asked this ...
0
votes
3answers
108 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
1answer
105 views

Caesar Pset2 Handles non-numeric key :(

I am tearing my hair out on this exercise. I cannot get it to pass a non-numeric key. I've played around with the code for 2 weeks now. I can either get it to handle a numeric key or handle a lack of ...
0
votes
2answers
50 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
68 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
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
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
27 views

Pset2 Caesar Memory Leak

I can't detect where I am leaking memory. Sometimes I get an unexpected output at the end of my array for cypher text and can't pass all test cases :(. Can someone point to me where I am wrong? Can ...
0
votes
1answer
90 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
59 views

Pset 2 caesar handles non-numeric key fail

Everything else in my program seems to run smoothly but I always get the problem of ":( Handles non-numeric key" but when I switch the atoi function with an isdigit function, it passes the handles non ...
0
votes
3answers
51 views

I'm getting an for error expected expression. What exactly I'm I doing wrong?

I mainly want my else statement to work, but it's not working. int main(int argc, string argv[]) { if (argc != 2) { printf("Usage: ./caesar key\n"); } else if (argc == 2) { for (int i = ...
0
votes
1answer
481 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
68 views

I got my code to work but it doesnot meet the requirements

:( handles non-numeric key timed out while waiting for program to exit the program: #include <stdio.h> #include <cs50.h> #include <stdlib.h> #include <ctype.h> #include &...
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
0answers
57 views

Need help for submitting caesar.c?

Hello guys, when I check my code manually it seems ok and here it is : #include <stdio.h> #include <cs50.h> #include <ctype.h> #include <stdlib.h> #include <string.h> ...
0
votes
1answer
679 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
1answer
17 views

Why does my code keep returning 1 with the error message even though I input a digit?

I am trying to complete the Caesar excercise on pset 2. My code compiles fine however it seems to give me me the output Usage: ./caesar key even though I input an int. Any help is much appreciated on ...
0
votes
1answer
36 views

Pset2 - Ceasar - Non Void function error

I am currently working on pset2 - ceasar. I have written my code but for some reason I have getting an expected expression error, which itself not very explanatory as to what is wrong with my code and ...
0
votes
1answer
43 views

I am trying to create program for checking command line arguments?

Check that program was run with one command-line argument. Iterate over the provided argument to make sure all characters are digits. Convert that command-line argument from a string to an int. code :...
0
votes
1answer
92 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
348 views

pset2 - Cipher - Invalid Slug

I'm struggling to check50/submit50 for the caeser cipher wk2 pset for CS50. Can anyone please advise what mistake I'm making? Code as linked: https://pastebin.com/5B7tcaGg I'm attempting to use; ...
0
votes
1answer
134 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
148 views

implicit declaration of function 'crypt' is invalid in C99

It keeps bringing up that error and I can't understand how it's happening and what's the fix here's the code with an error when calling the function crypt in main ///////////basic libraries void ...
0
votes
1answer
100 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
155 views

Validating the key in PSET2 caesar?

int main( int argc, string argv[]) { if(argc ==2) { for(int i = 0, n = strlen(argv[i]); i < n; i++) { if(isdigit(argv[1][i])) { ...
0
votes
1answer
4k views

PSET2, Caesar 2019: Validating Key

I've written up my code for Caesar and for the most part I'm happy with it. If I start the program with ./caesar 10, it registers 10 as the key, and "encrypts" the plaintext letters by 10. However, ...
0
votes
1answer
92 views

Problem with Caesar code for world, say hello!

My code is for pset2 caesar is: ##include <cs50.h> #include <stdio.h> #include <string.h> #include <ctype.h> int k; int main(int argc, string argv[]) { if (argc != 2) { ...
1
vote
2answers
1k views

Problems with check50 for pset2 caesar 2019

Hello! I have two questions that I hope someone can help out with! Q1) I just finished writing my solution for pset2-Caesar in CS50 Lab- When I try to check it with check50 I get an error message as ...
0
votes
1answer
248 views

Pset 2 Caesar: “invalid operands to binary expression ('string' (aka 'char *') and 'int')”

I am getting the following errors and I cannot figure out why. I've managed to work out the other bugs up until this. Would someone be able to point me in the correct direction? Kind regards, Sam ...
0
votes
1answer
338 views

Pset2 Caesar - Fails on “barfoo” only

After many many hours of trying to accomplish Caesar, check50 only yeilds one error: :) caesar.c exists. :) caesar.c compiles. :) encrypts "a" as "b" using 1 as key :) encrypts "barfoo" as "yxocll" ...
0
votes
1answer
310 views

PSET2 Caesar Segmentation Fault

So here's my code: #include <stdio.h> #include <cs50.h> #include <stdlib.h> #include <ctype.h> #include <string.h> int main(int argc, string argv[]) { (void)argc; (...
-1
votes
1answer
73 views

issue with check50 in pset2 caesar

This is my code https://pastebin.com/1uephEEh for cs50 pset2 caesar I am not able to find the problem I am getting correct output but somehow I am unable to pass the check50. If anyone could help me ...