Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please can u make sure this code is Run? EGR 111 Project 3 In this project, you are to write a code decipher program. Your

please can u make sure this code is Run?
EGR 111 Project 3 In this project, you are to write a code decipher program. Your program will use the following code conversion table to decipher a message provided in a file called SecretMessage.txt
Code Conversion Table
Coded Hex ValueActual ASCII LetterCoded Hex ValueActual ASCII Letter
41A4EN
42B4FO
43C50P
44D51Q
45E52R
46F53S
47G54T
48H55U
49I56V
4AJ57W
4BK58X
4CL59Y
4DM5AZ
The values in the left column of each half of the page (Coded Value) are Hexi-decimal. Each Hexi-decimal Value represents 4 binary bits. For example, the following sequence of bits is read in sequence at 4-bits per Hexi-Decimal letter:
0100 0110 which translates to 46 Hexi-decimal or the capital letter F.
As you may recall, the computer stores data 8 bits per address and if you were to look into those addresses, you would read either the eight binary bits stored or the Hexi-Decimal equivalent of the same. Those Hexi-decimal pairs represent ASCII characters. You have been provided a file with binary bits included and your program must read the values from the file in four-bit sequences, convert each four-bit sequence to its equivalent Hexadecimal value and then convert each Hexadecimal pair to the ASCII equivalent capital letter. The program will then output the secret message.
One example file would include:
0100 1000 0100 0101 0100 1100 0100 1100 0100 1111
Which translates to 48 45 4C 4C 4F
Which then translates to HELLO
A sample interaction would look as follows:
Welcome to the MC3 Code Converter! Please enter a filename for conversion:
The encrypted message contained in the file reads as follows:
Hello
The program then may ask the user if they wish to repeat decipher on a new filename.
Notes and Helpful Hints:
If you press for no, the program outputs a nice thank you message and exits.
If you press to repeat, the program loops back and repeats the conversion sequence.
You will need the following code lines to concatenate the filename you enter to the filestream path as well as to detect the end of the file you are reading:
#include
string secretFileName;
//Prompt the user for a file to be read
cout << "Welcome to the Code Converter, please enter a filename for conversion: ";
cin >> secretFileName;
system("CLS");
//Declare filestream with concatenated file name
ifstream infile(strcat(, secretFileName));
if (!infile)
{
cout << There was a problem reading the file. Correct and retry!;
exit(0);
}
//Read the file with the concatenated filestream
do
{
}while(!infile.eof());

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

Visual C# And Databases

Authors: Philip Conrod, Lou Tylee

16th Edition

1951077083, 978-1951077082

More Books

Students also viewed these Databases questions