diff --git a/2207/C语言同步练习源码/6-预处理-3.c b/2207/C语言同步练习源码/6-预处理-3.c index e69de29..9886a8d 100644 --- a/2207/C语言同步练习源码/6-预处理-3.c +++ b/2207/C语言同步练习源码/6-预处理-3.c @@ -0,0 +1,21 @@ +#include + +#define CHANGE 0 //1代表打印密文 0明文 +//! Ctrl + .注释 +int main(){ + char str[100], i=0; + scanf("%s", str); +#if CHANGE + while(str[i] != '\0'){ + if(str[i] >= 'a' && str[i] <= 'y' || str[i] >= 'A' && str[i] <= 'Y' ){ + str[i]++; + }else{ + str[i]-=25; + } + i++; + } +#endif + puts(str); + + return 0; +} \ No newline at end of file diff --git a/2207/C语言同步练习答案.md b/2207/C语言同步练习答案.md index 2efdaa4..f92831d 100644 --- a/2207/C语言同步练习答案.md +++ b/2207/C语言同步练习答案.md @@ -906,7 +906,29 @@ int main(){ ![image-20250227231325297](https://yp.smallkun.cn/markdown/image-20250227231325297.png!compress) +```c +#include +#define CHANGE 0 //1代表打印密文 0明文 +//! Ctrl + .注释 +int main(){ + char str[100], i=0; + scanf("%s", str); +#if CHANGE + while(str[i] != '\0'){ + if(str[i] >= 'a' && str[i] <= 'y' || str[i] >= 'A' && str[i] <= 'Y' ){ + str[i]++; + }else{ + str[i]-=25; + } + i++; + } +#endif + puts(str); + + return 0; +} +``` ## 结构体