凯撒密码c语言代码函数 凯撒密码c语言数组
凯撒密码 C语言
#includestdio.h
创新互联从2013年创立,是专业互联网技术服务公司,拥有项目成都网站制作、成都做网站网站策划,项目实施与项目整合能力。我们以让每一个梦想脱颖而出为使命,1280元丰泽做网站,已为上家服务,为丰泽各地企业和个人服务,联系电话:13518219792
#includestring.h
void main ()
{
char str[100];
char str1[100];
printf("输入字符串:");
scanf("%s",str);
int len;
len=strlen(str);
for(int i=0;i<len;i++)
{
str1[i]=(str[i]-97+3)%26+97;
}
str1[len]='\0';
printf ("密文为:%s\n",str1);
}
凯撒密码,C语言,求救!
#include stdio.h
#include string.h
int main()
{
int i = 0;
int len = 0;
char ch;
char buf[256] = {0};
char nor[26] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char enc[26] = {'s','u','w','y','a','c','e','g','i','k','m','o','q','r','t','v','x','z','b','d','f','h','j','l','n','p'};
printf("Encode or Decode: ");
scanf("%c",ch);
printf("please input your string: ");
fflush(stdin);
gets(buf);
len = strlen(buf);
switch (ch)
{
case 'e':
case 'E':
for (i=0;ilen;i++)
{
buf[i] = enc[buf[i] - 'a'];
}
break;
case 'd':
case 'D':
for (i=0;ilen;i++)
{
buf[i] = nor[i];
}
break;
default:
printf("wrong input!\n");
}
printf("%s\n",buf);
return 0;
}
c语言里的凯撒密码
#includestdio.h
#includestring.h
int main()
{
int i;int number;
char a[100];
scanf("%s",a);
number=strlen(a);
for(i=0;inumber;i++){
a[i]=a[i]+4;
}
for(i=0;inumber;i++){
printf("%c",a[i]);
}
return 0;
}
本文标题:凯撒密码c语言代码函数 凯撒密码c语言数组
分享URL:http://scyanting.com/article/dojdssh.html