您的位置:首页 > 其它

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。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  解题报告