The Caesar Cipher You are tasked to create an encryption program in C++ which ta
ID: 3672759 • Letter: T
Question
The Caesar Cipher
You are tasked to create an encryption program in C++ which takes a key word. The keyword will fill the first part of the shifted array. The remaining letters will fill the end of the array. It should look like this:
Key=”TOY
You should have an interactive menu with the following options:
1 Enter Key word //takes new key word and re-aligns shifted array
2 Encrypt message//takes a message of 140 characters and encrypts message
3 Decrypt message//takes an encrypted massage of 140 characters and decrypts it
4 Quit//exits program;
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z T O Y A B C D E F G H I J K L M N P Q R S U V W X ZExplanation / Answer
#include<stdio.h>
#include<iostream>
int main(){
string key;
cout<<"Enter Key:"<<endl;
cin>>key;
string opt;
char ch[]=str;
for(int i=0;i<=str.length;i++){
if(ch[i]=='A'){
opt=opt.concat('T');
}else if(B){
opt=opt.concat(O);
}
else if(ch[i]=='C'){
opt=opt.concat('Y');
}
else if(ch[i]=='D'){
opt=opt.concat('A');
}else if(ch[i]=='E'){
opt=opt.concat('B');
}
else if(ch[i]=='F'){
opt=opt.concat('C');
}
else if(ch[i]=='G'){
opt=opt.concat('D');
}
else if(ch[i]=='H'){
opt=opt.concat('E');
}
else if(ch[i]=='I'){
opt=opt.concat(F);
}
else if(ch[i]=='J'){
opt=opt.concat(G);
}
else if(ch[i]=='K'){
opt=opt.concat(H);
}
else if(ch[i]=='L'){
opt=opt.concat(I);
}
else if(ch[i]=='M'){
opt=opt.concat(J);
}
else if(ch[i]=='N'){
opt=opt.concat(K);
}
else if(ch[i]=='O'){
opt=opt.concat(L);
}
else if(ch[i]=='P'){
opt=opt.concat(M);
}
else if(ch[i]=='Q'){
opt=opt.concat(N);
}
else if(ch[i]=='R'){
opt=opt.concat('P');
}
else if(ch[i]=='S'){
opt=opt.concat('Q');
}
else if(ch[i]=='T'){
opt=opt.concat('R');
}
else if(ch[i]=='U'){
opt=opt.concat(S);
}
else if(ch[i]=='V'){
opt=opt.concat(U);
}
else if(ch[i]=='W'){
opt=opt.concat(V);
}
else if(ch[i]=='Y'){
opt=opt.concat(X);
}
else if(ch[i]=='Z'){
opt=opt.concat(Z);
}
}
cout<<"Encrypted is:"<<opt;
cout<<Decrypted is:<<str;
}