Urgent Question

int monoalphabatic()
{

char question1[]="please enter the plain text: ";
char question2[]="Please enter any key value : ";
char plain[]="abcdefghijklmnopqrstuvwxyz";
char cipher[26];
char text[100];
char key[25];


cout<<question1;
cin.ignore(256,'\n');
cin.get(text, 100);

cout<<question2;
cin.ignore(256,'\n');
cin.get(key, 26);


int c = 2 ;
cout<<"\nyou have entered: "<<endl;
cout<<"plaintext: "<<text<<endl;
cout<<"key : "<<key<<endl;
for(int i=0; i<26; i++)
{
int flag=0;
for(int j=0; key[j]!='\0'; j++)
{

c++;
if(key[j]==plain[i])
{
flag=1;
break;
}

}
// cout<<"break"<<" ";
if(flag==1)
{
flag=0;
key[c]=plain[i];
}


// return 0;
}

cout<<"\nafter: ";
for(int p=0; key[p]!='\0'; p++)
cout<<key[p];
return 0;
}
////////////////////////////////////////////////////////
i can compare two arrays, but here in this problem i have to compare plain[] with key[], and then paste characters from array plain[] to array key[], without any repeatition. someone plz help in this regard. also explain alittle, the nested loop.
use code tags please
Topic archived. No new replies allowed.