Question: A Caesar cipher is a simple way of obscuring words by shifting each letter in a word by a set amount n . For example,

A Caesar cipher is a simple way of obscuring words by shifting each letter in a word by a set amount n
. For example, when the shift is n=3
, the letter 'A' becomes 'D' and the letter 'B' becomes 'E'. Letters near the end of the alphabet "wrap-around", so that 'Z' becomes 'C' on a shift of 3.
Write a void function char_caesar that accepts a single char by reference (representing either a lower-case or an upper-case ASCII letter) as well as a single int shift amount of 0 to 25, and then modifies the char by shifting it by the given amount.
Provide a comment before your declaration of char_caesar with a purpose statement in the same format from the course notes. The lab instructors will check for the purpose statement and it needs to be correct and clearly written in order to be marked correct. Don't forget to include any requirements on the arguments.
In your main function scan for a character c (an upper-case or lower-case alphabetical character) and an integer n (from 0 to 25) and then use char_caesar to apply a shift of n to character c. Finally, print the updated value of c followed by a newline character.
Note. You can assume all input follows the given specification.
Examples
inputCopy
A 3
outputCopy
D
inputCopy
Z 3
outputCopy
C

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!