Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Could you solve this code for me please.and if you can write some explanation Thank you Question 2 : Write a CPP program that solves

Could you solve this code for me please.and if you can write some explanation
Thank you
Question 2: Write a CPP program that solves the following problem:
Problem:
A computer science professor designed an algorithm, the algorithm is used to encrypt or decrypt a message. The algorithm uses a matrix of size 66 as shown in figure below:
\table[[,0,1,2,,,],[),A,B,,D,F,],[,G,H,x,J,,],[2,M,N,O,P,,],[3,S,T,U,V,W,],[,Y,Z,0,1,2,],[,4,5,6,7,8,]]
Algorithm:
(1) Input InputMessage
(2) Get length of InputMessage
(3) Loop from i=0 to i length
a. Capitalize InputMessage[i] character if alphapet lower case, (a lower case character is converted to upper case by subtracting 32 from it).
b. Search for character InputMessage[i] in matrix to get its location
c. If character found in matrix[Row][Col] then, take the corresponding character in matrix[Col][Row] and insert into OuputMessage.
d. If character not found then insert space character into OutputMessage
(4) Print the outputMessage
(5) End.
Di:
In
The user should input a string as an InputMessage to encrypt or decrypt
Page 3 of 8
Output:
The program should print the encrypted or decrypted message
Sample Program Execution:
Sample(1):
Enter a message to encrypt or decrypt
My Name is Marwan ElHaj,I am 50 years old
Message after Encrypting or Decrypting is:
CE IACY ND CA61AI Y5HAT N AC LQ EYA6D 05S
Sample(2):
Enter a message to encrypt or decrypt CE IACY ND CA61AI Y5HAT N AC LQ EYA6D 05S
Message after Encrypting or Decrypting is:
MY NAME IS MARWAN ELHAJ I AM 50 YEARS OLD
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions