2.完成decrypt函数,实现解密功能:将任意密文实现解密输出。
加密规则:字符串中所有小写英文字母循环加密。如a到b,b到c,…,z到a。
如输入az ibwf b mjuumf bqqmf!,输出为:zy have a little apple!
#include <stdio.h>
#include <string.h>
void encrypt(char *s)
{
**int l=strlen(s);
for(int i=0;i<l;i++)
{
if(s[i]=='a') s[i]='z';
else if(s[i]>='b'&&s[i]<='z') s[i]--;
}**
}
int main()
{
char t1[80],ch;
gets(t1);
printf("\nthe original data is :%s",t1);
encrypt(t1);
printf("\nthe resulted data is :%s",t1);
printf("\n");
return 0;
}