首字母变大写:
#include<iostream> #include<string.h> #include<ctype.h> #include<stdio.h> using namespace std; #define N 1000 char str[N]; int main(){ while(gets(str)){ int len=strlen(str); str[0]=toupper(str[0]); int i; for(i=1;i<len;++i) if(str[i]==' ') str[i+1]=toupper(str[i+1]); for(i=0;i<len;++i) cout<<str[i]; cout<<endl; memset(str,'0',N*sizeof(char)); } return 0; }