write the algorithm for this the code?!.
#include<iostream>
using namespace std;
#include<string.h>
int main()
{
char plain[50], cipher[50]="", decrypt[50]="";
int subkeys[50], len;
cout<<"Enter the plain text:"<<endl;
cin>>plain;
cout<<"Enter the first subkey:"<<endl;
cin>>subkeys[0];
_strupr(plain);
len = strlen(plain);
/**********Find the subkeys**************/
for(int i=1; i<len; i++)
{
if ((plain[i-1]>='A') &&
(plain[i-1]<='Z'))
{
subkeys[i] = plain[i-1]-65;
}
}
/****************ENCRYPTION***************/
for(int i=0; i<len; i++)
{
if ((plain[i]>='A') && (plain[i]<='Z'))
{
cipher[i] = (((plain[i]-65)+subkeys[i])%26)+65;
}
}
cout<<"The cipher text
is:\t"<<cipher<<endl;
/****************DECRYPTION***************/
for(int i=0; i<len; i++)
{
if ((cipher[i]>='A') && (cipher[i]<='Z'))
{
decrypt[i] = ((cipher[i]-65)-subkeys[i])%26;
if (decrypt[i]<0) decrypt[i] += 26; //(if negative number,
add 26 to decrypt[i]
decrypt[i] += 65; // from number to ascii
}
}
cout<<"The decrypted text
is:"<<"\t"<<decrypt<<endl;
}