Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Has to be written in C programming For this assignment, you will write an interactive program that codes and decodes messages. The program should respond

Has to be written in C programming

image text in transcribed

image text in transcribed

For this assignment, you will write an interactive program that codes and decodes messages. The program should respond to 3 commands: c/C for code, d/D for decode, and q/Q for quit. In the case of code and decode: - the program reads in a message (stopping at end of line) code or decodes that message and prints out the result (the coded or decoded version of the original message) The encoding replaces every input character with 7 new ones. The original character is assumed to have an ASCII value less than 128, therefore it can be thought of as a 7 bit binary number. This binary number is then disguised as 7 seemingly random upper case letters. However the 7 bits are actually encoded in those letters: letters with an even ASCII value represent O's, letters with an odd ASCII value represent l's-Thus the letter 'W" which has an ASCII value of 87 (or in binary 101 01 1 1 ) could be encoded by the letters SLIFEMY because L and F have even ASCII values and the other letters have odd values. Decoding reverses this process, therefore a coded message has only capital letters and the number of letters is always an even multiple of 7. Your encodings should look random and for that you must use the rand ) function. Your program can assume all inputs are legal. Here is an example of the program running: [jhmayer@cssgate2 $ ./hwlx ? TCSS 333 WLMBCDROHDDDMOWFSJBESARCBNECDYXXPLRLMAPFWKHOKHNWKHSQBBUQ ? TCSS 333 CLIVSDTIXVTRSWQEMEDWSOFSBNUQHSXPHH2VKMLNOKPOKTZYABKINDOM ? TCSS 333 GDWDWFPIVTDLCGEHAHROKWPQBNYQXGDPBTRBSADDUETOKXHOAHWMXXYM > d ? WLMBCDROHDDDMOWFSJBESARCBNECDYXXPLRLMAPEWKHOKHNWKHSQBBUQ TCSS 333 > d ? CLIVSDTIXVTRSWQFMFDWSOFSBNUQHSXPHHZVKMLNOKPQKTZYABKINDOM TCSS 333 > d YM GDWDWEPIVTDLCGEHAHRQKWPOBNYOXGDPBTRBSADDUET TCSS 333 [jhmayer@cssgate2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Inference Control In Statistical Databases From Theory To Practice Lncs 2316

Authors: Josep Domingo-Ferrer

2002nd Edition

3540436146, 978-3540436140

More Books

Students also viewed these Databases questions