Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

[C++] This section of the program is supposed to take a message and split it int

ID: 3605746 • Letter: #

Question

[C++]

This section of the program is supposed to take a message and split it into two portions. Both portions are first checked for a few requirements, if the requirements are not met then an appropriate error message is printed instead of continuation.

--Portion 1 should only contain alphabet characters

--The numbers of characters in portion 1 has to be even.

--Either the number of tokens in portion 2 is not 4 or they are not made up of only digits.

A 2x1 matrix is then created named C from the first 2 characters of portion 1 in the alphabet letters. Then another matrix that is of 2x2 this time, named Square using tokens from portion 2. The two characters will be deciphered by new 2 characters that their position in the alphabet letters are calculated using a formula that is modded by 26 (for each letter)

EXAMPLE:

C'=(Square C)mod(26)

Message is "PQLG 4 3 2 7"

Portion1= PQLG

Portion2 = 4 3 2 7

Notice here the 15th letter in the alphabet is P, and Q being 16. The numbers just represent the numeric position in the alphabet.

Our original P and Q have been translated now into E and M, where E is the 4th character and M is the 12th character in the alphabet.

The above process is repeated for the next two characters in portion1 (LG). Matrix C changes but matrix Square remains the same. Since the matrix Square is a 2x2 matrix then the portion1 is always deciphered 2 characters at a time. This process continues until all characters in portion 1 are ciphered.

7 2

Explanation / Answer

Code:

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote