[YTU]_2803( 字符串中小写改大写)

Description

编写程序,输入字符串,将字符串中所有小写字母改为大写字母后输出该字符串。

Input

Output

Sample Input

abc123BNU

Sample Output

ABC123BNU
#include <iostream>
#include <cstring>
#include <string>
using namespace std;
int main()
{
    char str[101];
    int i;
    gets(str);
    for(i=0;str[i]!='\0';i++)
    {
        if(str[i]>=97&&str[i]<=122)
            str[i]=str[i]-32;   
    }
    cout<<str<<endl;
    return 0;
}

posted @ 2017-06-04 14:02  衣带渐宽、为伊憔悴  阅读(197)  评论(0编辑  收藏  举报