/*首字母大写
*/
#include<stdio.h>
#include<string.h>
int main(){
char str1[100];
printf("Enter the first string:");
fgets(str1,100,stdin);
for(int i =0;i<strlen(str1);i++){
if(str1[i] == ' ' || str1[i] == '\n' || str1[i] == '\t' || str1[i] == '\r'){
if(str1[i+1] >= 'a' && str1[i+1] <= 'z') str1[i+1] = str1[i+1] - 32;
}
}
printf("%s",str1);
return 0;
}
登录后发布评论
暂无评论,来抢沙发