Skip to main content

Questions tagged [caesar]

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

Filter by
Sorted by
Tagged with
0 votes
0 answers
22 views

My cs50 prset2 caesar project rfused to compile,

My cs50 pset2 caesar project refused to compile, what could be the problem. Says can't run until frown turn upside down.
Donald Udofia's user avatar
1 vote
1 answer
55 views

PSET 2 Caesar : help part 3 : ciphertext rotating correctly but not printing out

*Edited to include the latest changes in the code. Can someone help me spot the problem with my code? Below are the results from check50 and the code itself. TIA!! Here is the prior question: PSET 2 ...
AmyG's user avatar
  • 41
1 vote
1 answer
57 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
1 vote
1 answer
56 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
50 views

Problem Set 2, Ceasar, Testing Check50

I tried the Caesar Problem. Everything is going well, except when I want to test it. It shows that my output and the test output are the same, but my code couldn't pass the test. Even though I checked ...
Subhan SA's user avatar
0 votes
1 answer
66 views

Pset 2 Caesar: Problems with argv[] as a parameter

I have two main questions for my code. Please excuse me for my tideous code and for not using existing functions in the library, i.e. isdigit and strlen, as I didn't want to become dependent on them ...
pinkmonster's user avatar
0 votes
2 answers
32 views

Problem set 2 , Passes all tests when submitted but only give 2/11 grade

check50 results in all the tests passing but also produces a repetitive error, Invalid key. Please provide a positive integer. Cause Timed out while waiting for program to exit. Not sure which line ...
Geoff's user avatar
  • 11
0 votes
1 answer
77 views

pset 2 (caesar) - timed out while waiting for program to exit caesar

I can't understand what is the problem in code, it says "timed out while waiting for program to exit. I will be thankfull for any advices! #include <cs50.h> #include <stdio.h> #...
Soremegis's user avatar
0 votes
1 answer
78 views

I get Segmentation fault (core dumped) in Caesar

I'm trying to solve the Caesar pset, and I think I'm mostly on the right way, but I just started getting the error "Segmentation fault (core dumped)". I've attached the code, hopefully ...
rasmusschaal's user avatar
0 votes
1 answer
92 views

pset2 - caesar : output is providing extra symbols after specific input cases

If someone has the time to explain to me how I can fix my code that would be greatly appreciated! Thanks :) Problems that I need help with: 1 - Program needs to accept single character inputs like 'a' ...
karlares's user avatar
0 votes
1 answer
61 views

caesar.c check problem

I finished my caesar ps but when I check it says that my code is not correct for example the said it didn't encrypt an a to a b if the key is 1 even though when I check it myself I see that the answer ...
Ibhi Yassine's user avatar
0 votes
1 answer
85 views

Segmentation error on isdigit function

Been looking for answers to this, but having a lot of trouble. I am receiving a segfault that seems to be coming from the isdigit line, though I'm not sure what is happening to argv[1] to cause the ...
Josh Schaeffer's user avatar
0 votes
1 answer
380 views

Use of bool in PSET2

So i'm trying to approach this pset using functions more than i have in previous attempts. the hints suggested to use bool to check if key is valid. my code compiles and all the rest of the parts ...
tsull's user avatar
  • 1
0 votes
1 answer
46 views

Error when calling seconnd function - expected expression

I'm trying to call my encryption function and am getting an undeclared identifier error. Not sure where i'm going wrong. Code: #include <cs50.h> #include <stdio.h> #include <ctype.h> ...
tsull's user avatar
  • 1
0 votes
1 answer
159 views

How do I return my array of chars in a function to a string in main()

I'm having difficulty implementing the two sections of code for the caesar pset. Individually I have made both my main() and my rotating algorithm caesar() work, but am having trouble combining them, ...
krexaim's user avatar
0 votes
2 answers
229 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
104 views

Spoiler - PSET2 Caesar - why does plain text change when ciphertext changes?

while doing Pset2 Caesar, I came across this strange situation where my plaintext would change whenever my ciphertext changes. Ultimately my program compiles and passes check50, however, if the ...
Darren's user avatar
  • 3
1 vote
0 answers
437 views

How do you call a boolean function in main?

In problem set two it asks to use a separate function outside of main to determine if the string argv[1] has digits. I believe I've done this correctly in that function, but I'm struggling to call it ...
Alexander Siewert's user avatar
0 votes
1 answer
60 views

PSET2 -CAESAR - compiler doesn't see the rest of program

i have a problem with this pset. My program compiles properly, but when i'm launching it with key, it stops before get_string... When i'm using the only_digits function which is commented in bottom of ...
Kuba Oleksa's user avatar
0 votes
1 answer
121 views

Question CS50 2021 Caesar - where is the bug?

I'm currently struggling with a bug in caesar pset2. If i use check 50 everything is green except: :( encrypts "a" as "b" using 1 as key output not valid ASCII text :( ...
bloodycoder's user avatar
0 votes
1 answer
39 views

Segmentation fault: Data types for key and entered text by user while program operated through CLI

#include<stdio.h> #include<ctype.h> #include<cs50.h> #include<string.h> #include<stdlib.h> int main(int argc, string argv[]) { string enteredtext = argv[2]; ...
Splendid Digital Solutions's user avatar
0 votes
1 answer
499 views

How to rotate alphabetical characters by 26

#include<stdio.h> #include<ctype.h> #include<cs50.h> #include<string.h> int main(void) { string name = get_string("Enter: "); printf("Entered text by ...
Splendid Digital Solutions's user avatar
0 votes
2 answers
140 views

Caesar project: error: redefinition of 'i'

#include<stdio.h> #include<cs50.h> #include<string.h> int main(void) { string name = get_string("Enter: "); printf("%s\n",name); int n = strlen(name); printf(&...
Splendid Digital Solutions's user avatar
0 votes
1 answer
193 views

Caesar, trying to only accept digits help

I am trying to only accept digits. I turned Argv1 into an int with atoi, and used isdigit to confirm it is a digit being typed in. Why is it accepting both characters and digits?
Nicholas Dalman's user avatar
0 votes
1 answer
30 views

How do I assign a variable to all possible values of another variable?

I hope my question was worded right but I'm trying to solved pset2 caesar and i don't understand how to print something only if all the possible values of a variable fit the condition. If I input &...
maira's user avatar
  • 1
0 votes
1 answer
49 views

Pset 2 - Validating the Key

I'm very new to all this and so am struggling a bit with the for loop. Here is my code: #include <stdio.h> #include <stdlib.h> #include <cs50.h> #include <string.h> #include &...
aymencd's user avatar
0 votes
0 answers
48 views

One last error in pset2 Caesar regarding key 65 (barfoo) - lost for how to fix!

I have read just about every question and answer to exist on the internet about this problem, rewatched lecture segments and walkthroughs, and done additional research on the functions used to try and ...
pickles_and_olives's user avatar
0 votes
1 answer
90 views

Caesar problem. Keep getting error of segmentation

The follow part of code worked perfectly, while I declared variables key_num and plaintext within if{}, but since I declared them outside (cause I need to use these vars later) I get the "...
Igor Roytman's user avatar
0 votes
1 answer
43 views

Why is it asking me to declare (s) when is has been declared already?

#include <stdio.h> #include <cs50.h> #include <math.h> #include <string.h> #include <ctype.h> bool is_valid_key(string s); int main(int argc, string argv[]) { if (...
Bob Cap's user avatar
0 votes
1 answer
409 views

I believe my code is right but it's not giving output and pops segmentation fault

This is my code for Caesar Pset2. The code must be doing right but it's broken somehow. #include <stdio.h> #include <math.h> #include <string.h> #include <ctype.h> #include <...
aksharrastogi's user avatar
0 votes
1 answer
58 views

Question on pset2 caesar - segmentation

I am really stuck on pset2 Caesar. I can compile it, but when I try to enter valid command line argument, it keeps on saying that I have a Segmentation fault. That seems to mean that I access memory ...
Marie's user avatar
  • 3
1 vote
1 answer
253 views

Unable to confirm user input is a number using isdigit in c

My code is attempting to; take user input from the command line; check if the input is a whole number; confirm positively if so; confirm negatively if not; however all numbers return a negative ...
Shaun's user avatar
  • 13
0 votes
1 answer
52 views

Is argv[] changing my input?

I'm having trouble running my program, so I tried to look at it in debugger program. Is this screenshot telling me that argv1, shown on the right as **argv, is being recorded at a '.', and not the ...
Lperino's user avatar
  • 14
0 votes
1 answer
92 views

Caesar works as intended but check50 says it doesn't

I've tested all the possibilities where check50 says my code isn't working as intended and I always get the expected result. I can't seem to figure out what I did wrong. Here's check50: :) caesar.c ...
ninjoi's user avatar
  • 1
0 votes
1 answer
69 views

Hello everyone, i have a problem with my code for caesar

So when i run the following code in the caesar.c that is located in the caesar folder, it seems to run only for the very first character of the given plaintext and then the next characters are missing....
kostas's user avatar
  • 1
0 votes
1 answer
56 views

Implementation problem

#include <stdio.h> #include <ctype.h> #include <cs50.h> #include <string.h> #include <math.h> #include <stdlib.h> int main(int count, string input[]) { // ...
Mohamed Hassan's user avatar
0 votes
1 answer
46 views

Indexing problem

when debugging, the inner-most if condition never entered. Whether the char is upper-text or lower text. I 'm using the same methodology in both cases. // testing if the char upper text if ...
Mohamed Hassan's user avatar
0 votes
1 answer
160 views

caesar pset2 "expected expression and use of undeclared identifier" error

When compiling this code getting mutltiple errors any idee why is the couse of these errors thanks. #include <cs50.h> #include <stdio.h> #include <ctype.h> #include <string.h> #...
Matrix's user avatar
  • 67
0 votes
1 answer
786 views

incompatible integer to pointer conversion initializing 'char *' with an expression of type 'int'

I keep getting this error when I try to compile my program: incompatible integer to pointer conversion initializing 'char *' with an expression of type 'int' { if (argc != 2) { printf(&...
tabacool's user avatar
0 votes
1 answer
35 views

For loop proccing too many times

In the code below I check whether or not the string is or isn't a digit. To do that I iterate through every single value entered in the argv[1]. Unfortunately when the entered key is larger than one ...
Multiplify's user avatar
0 votes
1 answer
41 views

Program won't print out enciphered text

So under "Peeking under the hood" they asked to ignore the key the user provided and instead prompt the user for a plaintext and move each character by 1. when I run my program, and input &...
ehsansth's user avatar
0 votes
1 answer
103 views

How do I check that every character of an array is a digit and only print out the string if all the chars are digits?

So, in Caesar when validating the key they asked to check if all the characters in the command line argument provided are digits and only printout "Success" and the digits as an integer if ...
ehsansth's user avatar
0 votes
1 answer
23 views

Logical error in Caesar of Pset 2

The logical error is occurring when i try to shift each character of the plaintext by 1 string plaintext= get_string("plaintext: "); //aplplying key for(int j=0,m=strlen(plaintext);...
Reba Philip's user avatar
0 votes
1 answer
75 views

Error in Caesar of Pset2 while validating entered key

My question is regarding the step of 'Validating the Key' in Caesar of Pset2 , while checking whether the key given by user consists of digits. Here is my code : #include <stdio.h> #include <...
Reba Philip's user avatar
0 votes
3 answers
538 views

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

if (argv[1] == NULL) { printf("Usage: ./caesar key\n"); return(1); } this is the solution before the program received the first statement validate null
ramon chacon's user avatar
0 votes
2 answers
149 views

Caesar segmentation fault

I prematurely submitted my code without including the if() statements that check if the second command line argument was a digit (if not it would produce an error message). My code was running ...
laurens_noone's user avatar
0 votes
1 answer
66 views

Help with Either Command Line Argument or Arrays for Problem set 2 Caesar

I am on Problem Set 2: Caesar. Right now I'm trying to write code that first checks if the second command line argument is a int and if it does prints the integer. I got my program to compile after ...
Dre Johnson's user avatar
0 votes
2 answers
2k views

Caesar Error:Invalid operands to binary expression ('string' (aka 'char *') and 'int') int c = ((int)text + argv[1]) % 26

There are a few errors in my code, but the one I really don't understand is `caesar.c:25:42: error: invalid operands to binary expression ('string' (aka 'char *') and 'int') int c = ((int)...
cs50studnt2021's user avatar
0 votes
2 answers
1k views

Caesar : Extra random characters at the end of a char ciphertext array

I'm having a problem with an output. Sometimes output adds an extra characters, different each time the code runs. For example, when I use key "1" and write "a", it displays "...
D3sl0nG3r's user avatar
0 votes
1 answer
2k views

error: use of undeclared identifier 'argv' in Caesar

I dont know why this is wrong because it always says Caesar.c:17:13: error: use of undeclared identifier 'argv' even though it works for the ones before. #include <cs50.h> #include <stdio.h&...
FWI's user avatar
  • 1

1
2 3 4 5
9