Monday's Programming Question
Last week the challenge was to make a decoding program. It would seem silly not to make the encoder that goes with it.
Here's the same letter switch code:
| Decoded | a | b | c | d | e | f | g | h | i | j | k | l | m |
| Encoded | p | r | j | i | t | g | c | o | x | b | s | y | n |
| Decoded | n | o | p | q | r | s | t | u | v | w | x | y | z |
| Encoded | w | d | e | m | h | u | v | l | z | f | q | k | a |
This week write an encoder along the same principles of the decoder, except I want to highlight the difference between using a normal for loop and a "for each" loop. Your program should take a line of text entered by the user, use a combination of a for each loop and switch statement to encode it, and finally display the encoded line to the user.
The question is can your program encode this line?
it was a dark and stormy night


Comments
No comments yet. Leave a Comment