this is what i have done so far.

stuck at a point where im suppose input the array at random places.

Code:

#include<iostream>
#include<conio.h>
#include<stdio.h>
#include<cmath>
using namespace std;
int main()
{
char p[300],c[300],a[25][26];
int n,l,l2;
cout<<"ENTER THE PLAIN TEXT : \n"; /*what should be the procedure to eradicate special character case,
if any.(by comparing ASCII codes but how??)*/
for(int i=0;i<300;i++)
{
cin>>p[i];
if(p[i]=='.')
{
l=i;
break;
}
}
cout<<"\n\nENTER THE CIPHER TEXT : \n";
for(int k=0;k<300;k++)
{
cin>>c[k];
if(c[k]=='.')
{
if(k%2!=0)
{
cout<<"\n\nINVALID CIPHER TEXT(CANNOT PAIR IN DIAGRAPHS) ";//How to exit from the program??.
}
else
{
break;
}
}
}
l2=l;
for(int i=0;i<l2;i++)
{
if(i%2!=0)
{
if(p[i-1]==p[i])
{
p[i]='x';
for(int j=l2;j>=i+1;j--)
{
p[j+1]=p[j];
}
l2++;
p[i+1]=p[i-1];
}
}
else
{
continue;
}
}
cout<<endl<<endl;
for(int i=0;i<l2;i++)
{
if(i%2!=0)
{
cout<<p[i]<<" ";
}
else if(i==(l2-1)&&i%2==0)
{
cout<<p[i]<<'x';
}
else
{
cout<<p[i];
}
}
cout<<"\n\n";
//DECRYPTING
for(int i=0;i<l2;i++)
{
if(i%2!=0)
{
if(p[i-1]==c[i])
{
}
}
}
return 0;
}