#include <stdio.h>
#define MAXN 100
void encodeCourse(void);
void decodeCourse(void);
int main(void)
{
char c;
while(scanf("%c",&c)==1){
if(c=='1'){
encodeCourse();
}else if(c=='0'){
decodeCourse();
}
}
return 0;
}
void encodeCourse(void){
char encodedChar[MAXN];
int c;
printf("There are Words needed to be encodedCourse:");
int i=0;
while(scanf("%c",&c)==1){
if(c>='a'&&c<'x'){
c+=3;
}else if(c>='x'&&c<='z'){
c-=23;
}
encodedChar[i++]=c;
}
encodedChar[i]='\0';
printf("\nThere are encodedWords:%s\n",encodedChar);
}
void decodeCourse(void){
char decodedChar[MAXN];
int c;
printf("There are words needed to be decodedCourse: ");
int i=0;
while(scanf("%c",&c)==1)
{
if(c>'c'&&c<='z'){
c-=3;
}else if(c>='a'&&c<='c'){
c+=23;
}
decodedChar[i++]=c;
}
decodedChar[i]='\0';
printf("\nThere are decodedWords:%s\n",decodedChar);
}
加密解密
最新推荐文章于 2022-07-04 00:24:25 发布