首字母大写 题解(采用stl轻松解决):
#include<bits/stdc++.h>
using namespace std;
int main(){
char s[105];
gets(s);
char before = ' ';
for(int i = 0; i < strlen(s); i ++){
char ch = s[i];
if(isspace(before) && !isspace(ch)) s[i] = toupper(ch);
before = s[i];
cout << before;
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发