大小写转换 (sdut oj)
2017-02-01 20:14
176 查看
大小写转换
Time Limit: 1000MS Memory Limit: 65536KB
Problem Description
X现在要学习英文以及各种稀奇古怪的字符的了。现在他想把一串字符中的小写字母变成大写字符,大写字母变成小写字母,其他的保持不变。
Input
输入有多组。每组输入一个字符串,长度不大于80,不包含空格。
Output
输出转换后的字符串
Example Input
A* B+
Example Output
a* b+
Hint
Author
zmx参考代码
#include<stdio.h> #include<string.h> int main() { char a[100]; char b[100]; int n; int i; while(gets(a) != NULL) { n = strlen(a); for(i = 0; i < n; i++) { if(a[i] >= 'a' && a[i] <= 'z') { b[i] = a[i] - 32; } else if(a[i] >= 'A' && a[i] <= 'Z') { b[i] = a[i] + 32; } else { b[i] = a[i]; } } for(i = 0; i < n; i++) { printf("%c",b[i]); } printf("\n"); } return 0; }
相关文章推荐
- C语言实验——大小写转换 (sdut oj)
- asp金额大小写转换
- SysUtils.UpperCase、SysUtils.LowerCase - 大小写转换
- 大小写转换
- 位运算处理字符串大小写转换
- 英语字母大小写转换
- js字母大小写转换
- Linux 文件内容大小写转换
- vim 大小写转换
- c++字符串大小写转换
- 大小写转换
- SDUT OJ 2607
- python 大小写转换
- SDUT OJ 2798小鑫的城堡 并查集
- 数组-05. 字符串字母大小写转换(10)
- 06-2. 字符串字母大小写转换(10)
- 06-2. 字符串字母大小写转换(10)
- SDUT OJ 2122 数据结构实验之链表七:单链表中重复元素的删除
- SDUT OJ 之 1571 《人品,有没有?》 字符串的处理问题
- SDUT OJ 数据结构实验之栈:行编辑器