数组-05. 字符串字母大小写转换(10)
2015-02-02 19:09
197 查看
输入一个以#结束的字符串,本题要求将小写字母全部转换成大写字母,把大写字母全部转换成小写字母,其它字符不变。
输入格式:
输入在一行中给出一个长度不超过40的、以#结束的非空字符串。
输出格式:
在一行中按照要求输出转换后的字符串。
输入样例:
输出样例:
输入格式:
输入在一行中给出一个长度不超过40的、以#结束的非空字符串。
输出格式:
在一行中按照要求输出转换后的字符串。
输入样例:
Hello World! 123#
输出样例:
hELLO wORLD! 123
#include <iostream> #include <stdio.h> #include <math.h> #include <string> #include <stdlib.h> using namespace::std; int main(){ int count=0; char c[41],temp; int i=0; while((temp=getchar())!='#') { c[i]=temp; i++; count++; } for(int i=0;i<count;i++) { if(c[i]<='z'&&c[i]>='a') { c[i]=c[i]+'A'-'a'; } else if(c[i]<='Z'&&c[i]>='A') { c[i]=c[i]+'a'-'A'; } else{ } } c[count]='\0'; puts(c); return 0; }
相关文章推荐
- 数组-05. 字符串字母大小写转换(10)
- 数组-05. 字符串字母大小写转换(10)
- 数组-05. 字符串字母大小写转换(10)
- 数组-05. 字符串字母大小写转换(10)
- 数组-05. 字符串字母大小写转换(10)
- 数组-05. 字符串字母大小写转换(10)
- 数组-05. 字符串字母大小写转换(10)
- *数组-05. 字符串字母大小写转换
- 数组-05. 字符串字母大小写转换
- 6-2. 字符串字母大小写转换(10)
- 06-2. 字符串字母大小写转换(10)
- 06-2. 字符串字母大小写转换(10)
- 6-2. 字符串字母大小写转换(10)
- 06-2. 字符串字母大小写转换(10)
- PAT:6-2. 字符串字母大小写转换(10)
- 6-2. 字符串字母大小写转换(10)
- 字符串字母大小写转换(10)
- 06-2. 字符串字母大小写转换(10)
- 字符串字母大小写转换(10)
- 06-2. 字符串字母大小写转换(10)