字符串中第一个单词首字母大写
#include<stdio.h>#include<string.h>
#include<ctype.h>
int main()
{
int n,i;
char a[101];
scanf("%d",&n);
for(i=0;i<n;i++)
{
getchar();
gets(a);
for(i=0;i<strlen(a);i++){
if(a[i]==' '){
a[i+1]=toupper(a[i+1]);
}
}
for(i=0;i<strlen(a);i++){
if(a[i]==' '){continue;
}
else
printf("%c",a[i]);
}
printf("\n");
}
return 0;
}
输入 user name 输出userName
我的代码输入一个是正确的但输入多个就错了
user name
pass word
get message from HTTP response
find minimum path
userName
assWord
etMessageFromHTTPResponse
indMinimumPath