Eddy's mistakes解题报告
2013-08-04 20:15
375 查看
题目摘要:Eddy usually writes articles ,buthe likes mixing the English letter uses, for example "computerscience" is written frequently "coMpUtEr scIeNce" by him, thismistakes
lets Eddy's English teacher be extremely discontentment.Now please youto write a procedure to be able in the Bob article English letter to turncompletely the small letter.
题目大意:将给出的一串字符中大写字母改成小写。
输入输出要求:
Input
The input contains several test cases.eachline consists a test case,Expressed Eddy writes in an article , by letter, blank space,numeralas well as each kind of punctuation
composition, the writing length does not surpass 1000 characters.
Output
For each test case, you should output anonly line, after namely the result of transforms the lowercase letter.
输入输出样例:
Sample Input
weLcOmE tO HDOj Acm 2005!
Sample Output
welcome to hdoj acm 2005!
解题思路:直接用阿斯科马值,大写字母的阿斯科马值加上32就是小写字母。
代码:
#include<iostream>
#include<cstring>
#include<string>
using namespace std;
char str[1005];
int main()
{
while(cin.getline(str,1005))
{
for(int i=0;i<strlen(str);i++)
{
if((str[i]>='A')&&(str[i]<='Z'))
str[i]+=32;
}
cout<<str<<endl;
memset(str,'\0',sizeof(str));
}
return 0;
}
解题感想:这题主要涉及到用C++在字符数组中输入空格,而且涉及多组样例。搞定了输入一切ok。
lets Eddy's English teacher be extremely discontentment.Now please youto write a procedure to be able in the Bob article English letter to turncompletely the small letter.
题目大意:将给出的一串字符中大写字母改成小写。
输入输出要求:
Input
The input contains several test cases.eachline consists a test case,Expressed Eddy writes in an article , by letter, blank space,numeralas well as each kind of punctuation
composition, the writing length does not surpass 1000 characters.
Output
For each test case, you should output anonly line, after namely the result of transforms the lowercase letter.
输入输出样例:
Sample Input
weLcOmE tO HDOj Acm 2005!
Sample Output
welcome to hdoj acm 2005!
解题思路:直接用阿斯科马值,大写字母的阿斯科马值加上32就是小写字母。
代码:
#include<iostream>
#include<cstring>
#include<string>
using namespace std;
char str[1005];
int main()
{
while(cin.getline(str,1005))
{
for(int i=0;i<strlen(str);i++)
{
if((str[i]>='A')&&(str[i]<='Z'))
str[i]+=32;
}
cout<<str<<endl;
memset(str,'\0',sizeof(str));
}
return 0;
}
解题感想:这题主要涉及到用C++在字符数组中输入空格,而且涉及多组样例。搞定了输入一切ok。
相关文章推荐
- HDOJ-1164-Eddy's research I 解题报告
- PAT 解题报告 1049. Counting Ones (30)
- Sudoku Solver解题报告
- 【LeetCode】Intersection of Two Arrays II 解题报告
- UVa 1513 - Movie collection 解题报告(线段树)
- [BZOJ1010][HNOI2008]玩具装箱toy 解题报告
- 解题报告-HDOJ-1232(并查集)
- 九度1086解题报告
- [POJ2774]Long Long Message 解题报告
- hdu 1017 A Mathematical Curiosity 解题报告
- 第六届蓝桥杯2015本科B组c/++部分解题报告
- HIT summer training Contest 11 / 解题报告
- HDU 4059 The Boss on Mars 解题报告(4次方和+质因子分解+逆元+容斥原理)
- BZOJ 3901 棋盘游戏 解题报告
- [leetcode] 280. Wiggle Sort 解题报告
- [Leetcode] 59. Spiral Matrix II 解题报告
- TYVJ 1115 同余 解题报告
- BZOJ 3929 Circle of digits 解题报告
- 【LeetCode】Repeated Substring Pattern 解题报告
- HDU 1151 二分图的DAG最小路径覆盖 解题报告