Question: could you create a c + + program : DO NOT use functions, vectors, arrays, or any additional techniques we have not discussed in class.

could you create a c++ program :
DO NOT use functions, vectors, arrays, or any additional techniques we have not discussed in class.
The user will enter the name of a file that contains a random series of characters (the one-time pad). The user will then choose to encrypt or decrypt a message using that pad. The message is entered and the result is displayed.
The Process
Prompt the user for the filename. The user should enter a local filename.
Which file would you like to use?
Prompt the user for encryption/decryption. The user should enter an "E" or a "D".
Would you like to (E)ncrypt or (D)ecrypt?
if encrypt
Open the One-Time Pad (OTP) file
Prompt the user for a plain text string to encrypt
Enter the plain text string:
Read the plain text (PT) string from input
Map next PT character from [32-126] to [0-94]
Read character from OTP
Map OTP character from [32-126] to [0-94]
Get the cypher text (CT) character by adding OTP char to the PT char
Modulo the CT back to [0-94] range (if CT >94, CT = CT -95)
Map CT char from [0-94] to [32-126]
Display CT char
If there are more PT chars, go back to step 6
Close OTP file
if decrypt
Open the One-Time Pad (OTP) file
Prompt the user for a cypher text string to decrypt
Enter the cypher text string:
Read the cypher text (CT) string from input
Map next CT character from [32-126] to [0-94]
Read character from OTP
Map OTP character from [32-126] to [0-94]
Get the plain text (PT) character by subtracting OTP char from the CT char
Modulo the PT back to [0-94] range (PT <0, PT = PT +95)
Map PT char from [0-94] to [32-126]
Display PT char
If there are more CT chars, go back to step 6
Close OTP file
Note: You may assume for this project the OTP file and the entered message are well formatted and contain no errors.
Mapping
Moving a value from one range to another, or mapping the value, means to take a value (x) in one range, [inMin - inMax], and calculate the equivalent value (y) in a new range, [outMin - outMax]. The formula is
y=(x-inMin)((outMax-outMin)/(inMax-inMin))+outMin
The Example
for encryption
Which file would you like to use? OTPTest.txt Would you like to (E)ncrypt or (D)ecrypt? E Enter the plain text string: Bob is cool 1kx\:Uv[K*Z
for decryption
Which file would you like to use? OTPTest.txt Would you like to (E)ncrypt or (D)ecrypt? D Enter the cyper text string: 1kx\:Uv[K*Z Bob is cool

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!