知识点:
gets可以接受带空格的字符串
scanf和cin不能接受带空格的字符串
#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
int main(){
char a[100];
while(gets(a)){//输入一行字母
int i;
for(i = 0;a[i] != '\0'; i++){//直到末尾结束
if(i == 0){
a[i] = a[i] - 32;//将首字母改为大写
cout << a[i];
continue;
}
if(a[i-1]==' ')a[i] = a[i] - 32;
cout << a[i];
}
cout << endl;
}
return 0;
}