[Topic description]
给定一个字符串,将其中所有的小写字母转换成大写字母。
【enter】
输入一行,包含一个字符串(长度不超过100,可能包含空格)。
【Output】
输出转换后的字符串。
【Input sample】
helloworld123Ha
[Sample output]
HELLOWORLD123HA
【Code】
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int main()
{
char a[101];
gets(a);//gets 可以获取空格 cin不行
int len=strlen(a);//长度
for(int i=0;i<len;i++)
{
if( (a[i]>='a' && a[i]<='z') ) cout<< char(a[i]-32); //小写则-32变为大写
else cout<<a[i]; //否则正常输出
}
}