大小写转换

来源:互联网 发布:cities skylines mac 编辑:程序博客网 时间:2024/06/16 09:05

Problem Description

一丁小朋友刚刚学英文,书写单词的时候,常常混用大小写字母。
比如,“hello”有可能写成了“hELLo”。

为了帮助一丁小朋友规范化英文单词的书写,作为信息学奥林匹克竞赛的爱好者,请编程输出对应的小写字母组成的单词。
Input
输入数据首先包含一个正整数N,表示有N组测试用例。
每组测试用例占一行,包含一个长度不超过30的单词。

Output

请输出全部由小写字母组成的对应单词。
每组输出占一行。

Sample Input

2
hELLo
ILoveNoip

Sample Output

hello
ilovenoip

#include<iostream>#include<string.h>#include<stdlib.h>using namespace std;int main(){     char c[32];    int n,i,len;    cin >> n;    getchar();    while(n--)    {        gets(c);        len = strlen(c);        for(i=0;i<len;i++)        {            if(c[i]>'A' && c[i]<'Z')                c[i] +=32;        }        puts(c);    }    return 0;}