#include
main()
{
char s[30];
int i=0;
gets(s);
while(s[i]!='\0')
{
if(s[i]>='a'&&s[i]<='v'||s[i]>='A'&&s[i]<='V')
s[i]+=4;
else if(s[i]>='w'&&s[i]<='z')
s[i]=('a'-1)+4-('z'-s[i]);
else
{
if(s[i]>='W'&&s[i]<='Z')
s[i]=('A'-1)+4-('Z'-s[i]);
}
i++;
}
puts(s);
//system("pause");
return 0;
}
#include “stdio.h”
main()
{char c1;
while ((c1=getchar())!=‘\n’)
{if ((c1>=‘a’&& c1<=‘z’)||(c1>=‘A’ && c1<=‘Z’))
c1=c1+4;
if (c1>‘Z’ && c1<=‘Z’+4|| c1>‘z’)
c1=c1-26;
}
printf(“%d”,c1); }
}
请参考
#include
int main() {
char str[101];
int i;
while ( fgets(str, 100, stdin)!=NULL )
{
for (i = 0; '\0' != str[i]; i++)
{
printf( "%c", str[i] + 4 );
}
}
return 0;
}