Question
Write a program to decode secret messages, using the numeric key from data5a.txt, described below. Each line in the data file, data5b.txt will be a
Write a program to decode secret messages, using the numeric key from data5a.txt, described below. Each line in the data file, data5b.txt will be a string to be converted from the garbled characters into readable characters. The numeric key is the positive integer value that was added to the ascii characters numeric value to get the coded message. You should subtract that value to decode(remember to keep the character values in the range of a-z have numeric value between 97(a) and 122(z). If a character is outside after conversion, force that character back into the range). Any characters that do not start in that range should just be passed straight through, for instance the space(character = 32). All letters will be lower-case, punctuation and spaces should be passed straight through.
Sample output:
Spring 2017 Project 5 Due 3/10/17 by Your Name
the code is - *znk waoiq hxuct lud pasvkj ubkx znk rgfe jum* decoded is - *the quick brown fox jumped over the lazy dog*
the code is - *zu hk ux tuz zu hk zngz oy znk wakyzout* decoded is - *to be or not to be that is the question*
There were 2 codes processed |
Sample input:
dataSample5a.txt dataSample5b.txt
6
|
znk waoiq hxuct lud pasvkj ubkx znk rgfe jum zu hk ux tuz zu hk zngz oy znk wakyzout |
The ascii values for lowercase letters are given below.
a | b | c | d | e | f | g | h | i | j | k | l | m |
97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 |
n | o | p | q | r | s | t | u | v | w | x | y | z |
110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started