P5733 【深基6.例1】自动修正

慈善题

题目描述
大家都知道一些办公软件有自动将字母转换为大写的功能。输入一个长度不超过 100 且不包括空格的字符串。要求将该字符串中的所有小写字母变成大写字母并输出。

输入格式

输出格式

输入输出样例
输入
Luogu4!
输出
LUOGU4!

#include
using namespace std;
void mytoupper(char *s);
int main(){
	char word[101]={'\0'};
	gets(word);
	mytoupper(word);
	cout<<word;
}
void mytoupper(char *s){
    int len=strlen(s);
    for(int i=0;i<len;i++){
        if(s[i]>='a'&&s[i]<='z'){
            s[i]-=32;
        }
    }
}

你可能感兴趣的:(C++,洛谷,摸鱼)