Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++ The encryption program gives the user several choices for encrypting (or decrypting) the uppercase characters in a file. All non-uppercase letters are simply

In C++

The encryption program gives the user several choices for encrypting (or decrypting) the uppercase characters in a file. All non-uppercase letters are simply echoed. The encryption is only performed on uppercase characters.

Choice 1 No encryption, echo all characters in the file

Choice 2 Encrypt by shifting. For example, shifting by 3 characters would change an A to a D because that is 3 letters later. If you reach the end of the alphabet then you need to roll over. For example Z plus 3 is C.

NOTE: The process of converting the Z to a C should not need the use of an if statement. Do not use any ifs, switchs, loops for this part of the conversion.

Choice 3 Duplicate every other letter. For example, ABCD becomes AABCCD.

Choice 4 This will calculate a hash value. You will sum the ASCII values of all of the characters and at the end of the file print the last 2 digits of the sum. For example, ABC is 98 because A is 65, B is 66, C is 67, which has a sum of 198.

Choice 5 This is the opposite of choice 2. Instead of moving 3 letters forward, it will move 3 letters backwards. A D will become A.

Like choice 2, the shifting should be accomplished without ifs, switchs, and loops.

Choice 6 This is the opposite of choice 3. Change AABCCD back to ABCD.

Your program should prompt the user for:

The encryption type

The name of a file containing your message

Your program should output the encrypted message.

file1.txt has the following contents:

AAB CC

XYYZ

Sample Run #1: (the highlighted text is what the user types)

1 - No encrypt

2 - Shift 3 forward

3 - Double every other

4 - Find hash

5 - Shift 3 backward

6 - Remove characters

Choice? 1

Filename? file1.txt

AAB CC

XYYZ

Sample Run #2: (the highlighted text is what the user types)

1 - No encrypt

2 - Shift 3 forward

3 - Double every other

4 - Find hash

5 - Shift 3 backward

6 - Remove characters

Choice? 2

Filename? file1.txt

DDE FF

ABBC

Sample Run #3: (the highlighted text is what the user types)

1 - No encrypt

2 - Shift 3 forward

3 - Double every other

4 - Find hash

5 - Shift 3 backward

6 - Remove characters

Choice? 3

Filename? file1.txt

AAABB CCC

XYYYZZ

Sample Run #4: (the highlighted text is what the user types)

1 - No encrypt

2 - Shift 3 forward

3 - Double every other

4 - Find hash

5 - Shift 3 backward

6 - Remove characters

Choice? 4

Filename? file1.txt

86

Sample Run #5: (the highlighted text is what the user types)

1 - No encrypt

2 - Shift 3 forward

3 - Double every other

4 - Find hash

5 - Shift 3 backward

6 - Remove characters

Choice? 5

Filename? file1.txt

XXY ZZ

UVVW

Sample Run #6: (the highlighted text is what the user types)

1 - No encrypt

2 - Shift 3 forward

3 - Double every other

4 - Find hash

5 - Shift 3 backward

6 - Remove characters

Choice? 6

Filename? file1.txt

AB C

XYZ

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

More Books

Students also viewed these Databases questions

Question

1. Why do people tell lies on their CVs?

Answered: 1 week ago

Question

2. What is the difference between an embellishment and a lie?

Answered: 1 week ago