Reference no: EM132210430
Question :
Write a program in the language of your choice to implement th Caesar Cipher program.
A. Write a main function (Method,Procedure) that collects a message from the user and writes it out again. Assume the simplicity that the message contains no more than 10 characters and that only the 26 uppercase letters of the alphabet are used. Use an array of 10 elements to store the message.
Ask the user to enter no more than 10 characters, one per line, and to terminate the message by enterning some special character such as %.
Use a variable to keep track of the number of array elements actually used ( which could be fewer than 10 if the message is short) so that you do not write out meanigless characters stored at the end of the array.
B. Write a function (method, procedure) to modify the array to represent the encoded form of the message using the Caesar cipher. Have the main function ask for the shift amount.
Pass this information, along with the message array and the number of array elements actually used, to the encoding function. To get from one character to the character s units along in the alphabet, you can simply add s to the orginal character.
This works for everything except the end of the alphabet: here you will have to be a bit more clever to cycle back to the beginning of the alphabet once the shift is applied. Have the main function invoke the encoding function and then invoke WriteMessage to write out the encoded form of the message.