|
发表于 2020-1-13 17:07:38
|
显示全部楼层
- #include <stdio.h>
- #include <string.h>
- main(void)
- {
- int k ;
- char s[80] ;
- scanf("%s" , s) ;
- for(k = 0 ; k < strlen(s) ; k ++) if(s[k] >= 'A' && s[k] <= 'Z') s[k] = 'Z' - (s[k] - 'A') ;
- printf("%s\n" , s) ;
- }
复制代码
编译、运行实况:
- C:\Bin>cl x.c
- 用于 x86 的 Microsoft (R) C/C++ 优化编译器 19.00.24215.1 版
- 版权所有(C) Microsoft Corporation。保留所有权利。
- x.c
- Microsoft (R) Incremental Linker Version 14.00.24215.1
- Copyright (C) Microsoft Corporation. All rights reserved.
- /out:x.exe
- x.obj
- C:\Bin>x
- Hello,World!
- Sello,Dorld!
- C:\Bin>x
- ABCDEFGHIJKLMNOPQRSTUVWXYZ
- ZYXWVUTSRQPONMLKJIHGFEDCBA
- C:\Bin>
复制代码 |
|