#Caesar Cipher Issue
36 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
@full goblet
Your message appears to contain screenshots but no code. Please send code and error messages in text instead of screenshots if applicable!
Here's my answer, I get "TU," which supposedly is wrong
For reference: https://www.w3schools.com/charsets/ref_html_8859.asp, thanks in advance
@full goblet Has your question been resolved? If so, run !solved :)
are you sure you didn't have a typo in the input? I got the same thing
No typo
The thing is, I would just go with TU if it didn't specify in the question that I must obtain lower case characters
But it does
Maybe it's a question of "looping" the letters?
that threw me off too, but the input string is explicitly captials
I mean, there are 26 lower case letters in the alphabet
same number of upper case
Yeah I know
If the plaintext was "y," with k = 20, instead of heading to the upper case letters, maybe we can just "loop" back into the lower case letters? The ciphertext hence being "s"
Does this help at all?
In this situation
I was under the impression that's already what was expected
since that's how caesar ciphers work
Can't I just remove the + 'a' - 'a'?
@narrow sierra
char Shifted = 'a' + (UserInput - 'a' + ShiftAmount) % 26; = char Shifted = (UserInput + ShiftAmount) % 26;
Is this wrong
yes, there's paste error
no, because you want the modulo to be applied before "shifting" the values back into the alphabet
'a' is 96 under ASCII, so doing math modulo 26 isn't going to get you a letter
gotta shift it down so you're working with 0-25, do the cipher, then shift it back up
yes
Thanks