First write function EncryptChar, according to the following conversion rule given character C (encryption) for the new character

 

/ * 
Write your function EncryptChar, according to the following conversion rule given character C (encryption) to the new characters: 
"A" transformed "B", "B" is converted to "C", ... ... " Z "is converted to" a "," a "into" b ", ... ...," z " is converted to" A ", the other characters are not encrypted. 
Write a program that given the encrypted string. 
* / 
#Include <stdio.h> 
#include < String .h>
 void EncryptChar ( char ST [], int n-) {
     int I;
     for (I = 0 ; I <n-; I ++ ) {
         IF (ST [I] == ' the Z ' ) 
            ST [I] = ' A ' ;
         )
            st[i]='A';
        else{
            st[i]=st[i]+1;
        }
    }
}
int main()
{
    char st[100];
    gets(st);
    int n=strlen(st);
    EncryptChar(st,n);
    puts(st);
    return 0;
}

 

Guess you like

Origin www.cnblogs.com/zhaohuan1996/p/11934671.html