hi friends,


I am an amateur C++ programmer... I am using turbo c++ V4.5.. after reading about the google code breaking thing on the internet, i became interested in simple substitution cipher.. the one using a keyword..I know the logic behind the program. yet I need your guidance about execution of it.. i have several doubts.. they include
1) how to generate alphabets by omiting the letters in the keyword? is it possible to omit alphabets in for loop? if so how?
2) I should input the alphabets in character arrays,right?
i will try to do the rest... please bear in mind that I am just a beginner in C++.. and am doing it all on turbo c++.I dont understand the language of any other versions like Vc++.
please understand the fact that I am not demanding any1 to do it all for me...!!! all I want is a guidance from great guys like you.. hope you wont disappoint me

This my code... now, I am a bit confused about the furthur steps.. What I need to do now is compare each word in the msg to be coded with a,b,c,d....z and corresponding letters in the cipher and create the enciphered message.. but instead of using an array with alphabets from a to z should I use an 'enum' and giv values of 0,1,.... 25 to a,b,....z .. If so how do I execute that step? I dont need you guys to do it for me, jus giv me code fragment and guidance..

#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
char a[10],c[50],b[100],d[100],e[26],ch='a',p='a';
int n,i,j,k,flag=0,l,m,g;
cout<<"Enter the keyword \n";
cin>>a;
cout<<"Enter the message to be encrypted \t";
cin>>b;
m=strlen(b);
n=strlen(a);
l=n;
for (i=0;i<n;i++)
{
c[i]=a[i];
 }
 while(ch<='z')
 {
 for(j=0;j<n;j++)
 {
 if(ch==a[j])
 flag=1;
 }
 if(flag!=1)
 {
 c[l]=ch;
 l++;
 }
 ch++;
 flag=0;}

for(k=0;k<m;k++)
{
d[k]=c[k];
	}

 for(g=0;g<26;g++)
 {/*{
 while(p<='z')
 {
 e[g]=p;

 p++;
 } */


cout<<c[g];
//cout<<e[g];
}
getch();

}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.