2026 首字母变大写

来源:互联网 发布:三国名将法宝进阶数据 编辑:程序博客网 时间:2024/04/30 07:14
#include<iostream>using namespace std;int main(void){    string str;    while(getline(cin,str))    {        str=" "+str;        for(int i=1;i<str.length();i++)        {            if(str[i-1]==' ')            {                if(str[i]>='a'&&str[i]<='z')                {                    str[i]-=32;                }            }            cout<<str[i];        }        cout<<endl;    }    return 0;}