Chapter 2: Problem 21
Write an algorithm that generates a Caesar cipher-a secret message in which each letter is replaced by the one that is \(k\) letters ahead of it in the alphabet, in a circular fashion. For example, if \(k=5\), then the letter a would be replaced by the letter \(f\), and the letter \(x\) would be replaced by the letter c. We'll talk more about the Caesar cipher and other encryption algorithms in Chapter 8.) The input to your algorithm is the text to be encoded, ending with the special symbol " \(\$$ ", and the value \)k$. (You may assume that, except for the special ending character, the text contains only the 26 letters a ... z.) The output of your algorithm is the encoded text.
Short Answer
Step by step solution
Key Concepts
These are the key concepts you need to understand to accurately answer the question.