Question
In cryptography, encryption is the process of encoding a message or information in such a way that only authorized parties can access it. In this
In cryptography, encryption is the process of encoding a message or information in such a way that only authorized parties can access it. In this lab you will write a program to decode a message that has been encrypted.
Define a class with the following:
A variable to hold an encrypted message. This variable should be a c-string whose storage space will be allocated by the constructor.
A status variable that will tell whether the message was loaded successfully.
A constructor that receives two parameters: a string variable with the file name and an int variable with the maximum number of bytes that can be uploaded (use this parameter to dynamically allocate space for the variable that will hold the message). You must be careful to not read more characters than you allocated for the c-string variable or you risk having your program crash. After you successfully read the message from the file, set the value of the status variable to true.
A function that returns the value of the status variable. The value of this variable should always be checked prior to decoding, since trying to decode an empty string may result in your program crashing.
A function that decodes the message and prints it on the screen. Use the following key to decode:
input character: abcdefghijklmnopqrstuvwxyz
decoded character: iztohndbeqrkglmacsvwfuypjx
That means each 'a' in the input text should be replaced with an 'i', each 'b' with a 'z' and so forth.
A function that prints the message on the screen
Write a program that tests your class.
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