字符串的加密 编写函数

img

一个简单的实现:


#include <stdio.h>

void Convert(char s[]){
    int i = 0 ;
    
    while(s[i]!='\0'){
        
        if(s[i]=='z'){
            s[i] = 'a';
        }else if(s[i]=='Z'){
            s[i] = 'A';
        }else{
            s[i] = s[i]+1;
        }
        i++;
    }
    
}

int main(){
    char str[80];
    
    gets(str);
    
    Convert(str);
    
    
    printf("%s\n",str);
    
    return 0;
}