变换规则是:小写字母z变换成为a,其它字符变换成为该字符ASCII码顺序后1位的字符,比如o变换为p。
要求输入一个字符串(少于80个字符),输出相应的密文;要求定义和调用函数encrypt(s),该函数将字符串s变换为密文。
#include<stdio.h> #include<string.h> #define MAXLINE 100 //*定义一个预定常量 void encrypt(char*); //*调用加密函数 int main(void) { char line [MAXLINE]; //*标明数组的长度 printf("Input the string:"); gets(line); encrypt(line); printf("%s%s ","After being encrypted:",line); return 0; } void encrypt(char*s) { for(;*s!='