好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

1165: 零起点学算法72——首字母变大写

1165: 零起点学算法72——首字母变大写

Time Limit: 1 Sec   Memory Limit: 64 MB   64bit IO Format: %lld
Submitted: 705   Accepted: 439
[ Submit ][ Status ][ Web Board ]

Description

输入一个英文句子,将每个单词的第一个字母改成大写字母。

 

Input

 

输入数据包含多个测试实例,每个测试实例是一个长度不超过100的英文句子,占一行。

 

Output

请输出按照要求改写后的英文句子。

 

Sample Input

 

 i like acm
i want to get an accepted 

 

Sample Output

 I Like Acm
I Want To Get An Accepted
 

 

Source

零起点学算法

 

  1  #include<stdio.h>
  2   int   main(){
   3       char  a[ 100  ];
   4       while (gets(a)!= NULL){
   5          a[ 0 ]+= '  A  ' - '  a  '  ;
   6           for ( int  i= 1 ;a[i]!= '  \0  ' ;i++ ){
   7               if (a[i]== '   ' ) a[++i]+= '  A  ' - '  a  '  ;
   8           }
   9           puts(a);
  10       }
  11       return   0  ;
  12  }

 

查看更多关于1165: 零起点学算法72——首字母变大写的详细内容...

  阅读:52次