Accepted
/in/foo.c: In function 'main': /in/foo.c:7:5: warning: 'gets' is deprecated [-Wdeprecated-declarations] gets(ch); ^~~~ In file included from /in/foo.c:1:0: /usr/include/stdio.h:640:14: note: declared here extern char *gets (char *__s) __wur __attribute_deprecated__; ^~~~ /tmp/ccByYKvt.o: In function `main': foo.c:(.text.startup+0xc): warning: the `gets' function is dangerous and should not be used.
代码
#include <stdio.h>
int main()
{
int j;
char ch[80];
gets(ch);
j = 0;
while(ch[j] != '\0')
{
if(((ch[j] >= 'A') && (ch[j] <= 'Z')) || ((ch[j] >= 'a') && (ch[j] <= 'z')))
{
if(((ch[j] >= 'W') && (ch[j] <= 'Z')) || ((ch[j] >= 'w') && (ch[j] <= 'z')))
{
ch[j] = ch[j] - 22;
}
else
ch[j] = ch[j] + 4;
}
else if((ch[j] >= '0') && (ch[j] <= '9'))
{
ch[j] = '9' - ch[j] + '0';
}
else
{
ch[j] = ch[j];
}
j++;
}
puts(ch);
return 0;
}