#include<stdio.h>
#include<string.h>
int main()
{
char a[200],t,k;
int m,n,j,i;
scanf("%d",&n);
for(i=0;i<n;i++)
{
gets(a);
if(a[0]!=' ')
if(a[0]>='a'&&a[0]<='z')
{
t=a[0]-32;
printf("%c",t);
}
else
printf("%c",a[0]);
m=strlen(a);
for(j=0;j<m;j++)
{
if(a[j]==' '&&a[j+1]!=' ')
{
if(a[j+1]>='a'&&a[j+1]<='z')
{
k=a[j+1]-32;
printf("%c",k);
}
else
printf("%c",a[j+1]);
}
}
printf("\n");
}
return 0;
}
[ New Thread ]
Problem 3997 >> 答案错误,找不到原因 |
201803010212 @ 2019-05-15 21:37:17
|
201703120121 @ 2019-05-16 18:55:00
scanf("%d",&n);后加getchar();
防止回车被读到字符数组a中 |