C语言字符串加密

2024-12-26 17:34:41
推荐回答(2个)
回答1:

1.main()
{char password[80];
int i;
scanf("%s",password);
for(i=0;password[i]!='\0';i++)
password[i]=password[i]+13;
}
2.#include "stdlib.h"
struct pw
{char ch1,ch2;
struct pw *next;}
main()
{struct pw p,head;
int i;
head=(struct pw *)malloc(sizeof(struct pw));
p=head;
for(i=1;i<=10;i++)
{scanf("%c",&p->ch1);
p->ch2=p->ch1+13;
p->next=(struct pw *)malloc(sizeof(struct pw));
p=p->next;
p->next=NULL;}
p=head;
}

回答2:

#include

encode(char * s)
{
char * x = s;
if (!x) return;
while(*x) {
(*x) += (char)2;
x++;
}
}

main()
{
char a[80];
scanf("%s", a);
encode(a);
printf(a);
}