题解 | #首字母大写#

首字母大写

https://www.nowcoder.com/practice/91f9c70e7b6f4c0ab23744055632467a

#include <stdio.h>
#include <string.h>
int main() {
    char s[100]={0};
    int i,count;
    while(gets(s)){
        i=0;
        if(s[0]>='a' && s[0]<='z') s[0]-=32;
        while(s[i]!='\0'){
            i++;
            if(s[i]==' ' || s[i]=='\n' || s[i]=='\r' || s[i]=='\t'){
                while(s[i]==' ' || s[i]=='\n' || s[i]=='\r' || s[i]=='\t'){
                    i++;
                }
                if(s[i]>='a' && s[i]<='z') s[i]-=32;
            }
        }
        puts(s);
    }
    return 0;
}

全部评论

相关推荐

迷茫的大四🐶:只有花了钱才能吃一堑长一智
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务