📄 scramble.c
字号:
#include <stdio.h>
#include <ctype.h>
void rot13(char *string);
void main()
{
char phrase[] = "A pig fell in the mud.";
printf("The phrase is:\n");
puts(phrase);
rot13(phrase); //rot13 the phrase
printf("The scrambled phrase is:\n");
puts(phrase);
rot13(phrase); //rot13 it again
printf("And unscrambled:\n");
puts(phrase);
}
void rot13(char *string)
{
int count = 0;
char c = '!'; //initialize c
while(c)
{
c = string[count];
if(isalpha(c))
{
if(toupper(c)>='A' && toupper(c)<='M')
c+=13;
else
c-=13;
}
string[count] = c;
count++;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -