Zaadxdzio zgXdamvyj apixodji
D ocjpbco ja dhkmjqdib ocz rvt wt rcdxc D rvn ovfdib dikpo nziozixz amjh ocz pnzm viy D xvhz pk rdoc ocdn vkkmjvxcC
I would just say that the key is 21.
Enjoy! :)
#include<vector>
#include<iostream>
#include<math.h>
#define SIZE_OF_THE_SENTENCE 1000
/* Tjp xvi xcvibz ocz nduz ja ocz nziozixz hvxmj da
* ajm dinovixz tjp rvio oj zixmtko viy yzZixmtko v
* wdbbzm nziozixz
*/
using namespace std;
void cifrado(){
cout<<"Enter the string which you want to encrypt,"
" and then, Type xyz and enter to"
" terminate the entry."<<endl;
vector<string> s;
for(int i=0;i<SIZE_OF_THE_SENTENCE;i++){
string st;
cin>>st;
if(st=="xyz"){
break;
}
// cin>>str[i];
s.push_back(st);
}
cout<<"Now enter the level of encryption, from 0 to 30,"
" and remember this level if you wish to deEncrypt "
"this string in future. "<<endl;
int k;
cin>>k;
int val;
int s_size=s.size();
for(int i=0;i<s_size;i++){
int s_0=s[i].size();
for(int j=0;j<s_0;j++){
if(s[i].at(j)>=97){
val=s[i].at(j)-'a';
val=(val+k)%26;
s[i].at(j)='a'+val;
}
if(s[i].at(j)<97){
val=s[i].at(j)-'A';
val=(val+k)%26;
s[i].at(j)='A'+val;
}
}
}
cout<<"The encrypted version of your string is:- ";
for(string st:s){
cout<<st<<" ";
}cout<<endl;
}
void deCifrado(){
cout<<"Enter the encrypted string which"
" you want to deEncrypt, and then type xyz"
" and hit enter"<<endl;
vector<string> s;
for(int i=0;i<SIZE_OF_THE_SENTENCE;i++){
string st;
cin>>st;
if(st=="xyz"){
break;
}
s.push_back(st);
}
cout<<"What was the level of encryption of"
" your encrypted string from 0 to 30. "<<endl;
int k;
cin>>k;
int val;
int s_size=s.size();
for(int i=0;i<s_size;i++){
int s_elem_size=s[i].size();
for(int j=0;j<s_elem_size;j++){
int current_elem=s[i].at(j);
if(current_elem<97){
val=current_elem-'A';
s[i].at(j)=((val+(26-k))%26)+'A';
}
if(current_elem>=97){
val=current_elem-'a';
s[i].at(j)=((val+(26-k))%26)+'a';
}
}
}
cout<<"The deEncrypted version of your string is:- \n";
for(string str:s){
cout<<str<<" ";
}cout<<endl;
}
int main(){
/*
*
* Ocdn kmjbmvh dn ocz diozggzxopvg kmjkzmot ja ocz
* Cvga Wgjjy Kmdixz
*
*/
return 0;
}
Comments
Post a Comment