The Caesar Cipher: Privacy in communication has been an issue ever since the dawn of time. To prevent people from stealing information, w "Encrypt" and "Decrypt" it in several ways. To encrypt something means that the message gets translated into a secret code that only the people involved can understand, decrypt is the opposite procedure. One of the oldest methods of encryption is called the Caesar Cipher Named after the dictator Julius Caesar). It consists of assigning every letter a number value and writing the word as a sequence of numbers. Consider the Caesar cipher where each character gets assigned its value in the ASCII code. a b C d C f 97 98 99 100 101 102 g h i j k 1 103 m 104 105 106 107 108 109 n O a Input I hi there S 110 t 111 The problem is to create a C++ program that receives an encrypted message, translates it, then receives an answer from the user in English and encrypts it. To do this and get full marks you are to create 5 functions, both the function prototypes and the main unction are provided. 112 113 114 115 116 u 117 V W X 5 104 101 108 108 111 118 y 119 .A function that reads the input array. . A function that translates the input and prints the translated message. 120 . A function that reads a string and returns it. . A function that receives a string of letters and encrypts it, returning an array. . A function that prints the answer array. 121 Z 122 Input: The first number N it receives is the length of the received code, then it receives a sequence of N integers. After printing the translated message it should read your answer to be translated. Example: Output hello Assume it always receives a valid input, this is, N 2 1, all numbers in the original code are between 0 and 26 and all the characters i the response are either a space or lowercase letters. 104 105 32 116 104 101 114 101

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
C++ please
The mistnumberNiTeceive
translated message it should read your answer to be translated.
Example:
engur of the received code, men receives a sequuntou or
5
104 101 108 108 111
Input
104 105 32 116 104 101 114 101
Assume it always receives a valid input, this is, N 21, all numbers in the original code are between 0 and 26 and all the characters in
the response are either a space or lowercase letters.
hi there
#include <iostream>
#include <string>
using namespace std;
1
1
int main(){
Output
//function prototypes
void read_array (int input [], int size);
void translate_to_english (int input [], int size);
hello
string read_answer ();
void encrypt (string answer, int encrypted_ans []);
void print_array( int array [], int size);
//define and read the received array
int array_size;
cin >> array_size;
int A[ array_size];
read_array(A, array_size);
//decode the received message
translate_to_english( A, array_size);
cin.ignore (100, '\n');
answer= read_answer();
//define and read the answer from the user
string answer;
//clears the buffer
//encode the answer into an array of numbers
int answer_array [ answer.length()];
encrypt( answer, answer_array );
print_array( answer_array, answer.length() );
return 0;
Transcribed Image Text:The mistnumberNiTeceive translated message it should read your answer to be translated. Example: engur of the received code, men receives a sequuntou or 5 104 101 108 108 111 Input 104 105 32 116 104 101 114 101 Assume it always receives a valid input, this is, N 21, all numbers in the original code are between 0 and 26 and all the characters in the response are either a space or lowercase letters. hi there #include <iostream> #include <string> using namespace std; 1 1 int main(){ Output //function prototypes void read_array (int input [], int size); void translate_to_english (int input [], int size); hello string read_answer (); void encrypt (string answer, int encrypted_ans []); void print_array( int array [], int size); //define and read the received array int array_size; cin >> array_size; int A[ array_size]; read_array(A, array_size); //decode the received message translate_to_english( A, array_size); cin.ignore (100, '\n'); answer= read_answer(); //define and read the answer from the user string answer; //clears the buffer //encode the answer into an array of numbers int answer_array [ answer.length()]; encrypt( answer, answer_array ); print_array( answer_array, answer.length() ); return 0;
The Caesar Cipher:
Privacy in communication has been an issue ever since the dawn of time. To prevent people from stealing information, w
"Encrypt" and "Decrypt" it in several ways. To encrypt something means that the message gets translated into a secret code that
only the people involved can understand, decrypt is the opposite procedure.
One of the oldest methods of encryption is called the Caesar Cipher Named after the dictator Julius Caesar). It consists of
assigning every letter a number value and writing the word as a sequence of numbers.
Consider the Caesar cipher where each character gets assigned its value in the ASCII code.
a
b
C
d
C
f
97
98
99
100
101
102
g
h
i
j
k
1
103
m
104
105
106
107
108
109
11
0
Input
111
112
9 113
114
115
Г
116
P
hi there
110
S
t
The problem is to create a C++ program that receives an encrypted message, translates it, then receives an answer from the user in
English and encrypts it. To do this and get full marks you are to create 5 functions, both the function prototypes and the main
unction are provided.
u
V
5
104 101 108 108 111
W
X
y
117
7
118
119
120
A function that reads the input array.
.
.A function that translates the input and prints the translated message.
. A function that reads a string and returns it.
. A function that receives a string of letters and encrypts it, returning an array.
. A function that prints the answer array.
121
Input:
The first number N it receives is the length of the received code, then it receives a sequence of N integers. After printing the
translated message it should read your answer to be translated.
Example:
122
Output
hello
Assume it always receives a valid input, this is, N 2 1, all numbers in the original code are between 0 and 26 and all the characters i
the response are either a space or lowercase letters.
104 105 32 116 104 101 114 101
Transcribed Image Text:The Caesar Cipher: Privacy in communication has been an issue ever since the dawn of time. To prevent people from stealing information, w "Encrypt" and "Decrypt" it in several ways. To encrypt something means that the message gets translated into a secret code that only the people involved can understand, decrypt is the opposite procedure. One of the oldest methods of encryption is called the Caesar Cipher Named after the dictator Julius Caesar). It consists of assigning every letter a number value and writing the word as a sequence of numbers. Consider the Caesar cipher where each character gets assigned its value in the ASCII code. a b C d C f 97 98 99 100 101 102 g h i j k 1 103 m 104 105 106 107 108 109 11 0 Input 111 112 9 113 114 115 Г 116 P hi there 110 S t The problem is to create a C++ program that receives an encrypted message, translates it, then receives an answer from the user in English and encrypts it. To do this and get full marks you are to create 5 functions, both the function prototypes and the main unction are provided. u V 5 104 101 108 108 111 W X y 117 7 118 119 120 A function that reads the input array. . .A function that translates the input and prints the translated message. . A function that reads a string and returns it. . A function that receives a string of letters and encrypts it, returning an array. . A function that prints the answer array. 121 Input: The first number N it receives is the length of the received code, then it receives a sequence of N integers. After printing the translated message it should read your answer to be translated. Example: 122 Output hello Assume it always receives a valid input, this is, N 2 1, all numbers in the original code are between 0 and 26 and all the characters i the response are either a space or lowercase letters. 104 105 32 116 104 101 114 101
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 3 images

Blurred answer
Knowledge Booster
Unreferenced Objects
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education