//file name: exp4-4. CPP
//# include "sqstring. H" contains order list of the basic computing algorithm
SqString A, B;//global string
SqString EnCrypt_lhl (SqString p)
{
int i=0;
int j;
SqString q;//returns the encrypted string
While (I & lt; P.l ength)
{
For (j=0; Conviction yourself ata [I]!=a. d. ata [j]; J++);
If (j & gt;=p.l ength)//was not found in A string of conviction yourself ata [I] letter
Q.d ata [I]=conviction yourself ata [I];
The else//find conviction yourself in A string of ata [I] letter
Q.d ata [I]=B.d ata [j];
i++;
}
Q.l ength=p.l ength;
The return of q;
}
SqString UnEncrypt_lhl (SqString q)
{
int i=0;
int j;
SqString p;//return the original string
While (I & lt; Q.l ength)
{
For (j=0; Q.d ata [I]!=B.d ata [j]; J++);
If (j & gt;=q.l ength)//was not found in B string q.d ata [I] letter
Conviction yourself ata [I]=q.d ata [I];
The else//found in B string q.d ata [I] letter
Conviction yourself ata [I]=a. d. ata [j];
i++;
}
P.l ength=q.l ength;
return p;
}
Int main ()
{
SqString p, q;
Int ok=1;
StrAssign (A, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");//set up A series of
StrAssign (B, "NgzQTCobmUHelkPdAWxfYIvrsJGnZqtcoBMuhELKpaDWXFyiVRjs");//build string B
Char STR [MaxSize];
printf("\n");
Printf (" input text string: ");
Gets (STR);//get the user input text string
StrAssign (p, STR);//set up p series
Printf (" encryption to decrypt as follows: \ n ");
Printf (" the original string: "); DispStr (p);
Q=EnCrypt_lhl (p);/has q/p of encrypted string
Printf (" encrypted string: "); DispStr (q);
P=UnEncrypt_lhl (q);//q series decryption produce p series
Printf (" decrypt the string: "); DispStr (p);
printf("\n");
DestroyStr (p);
DestroyStr (q);
return 1;
}