Locoluis

capitalze first letter of each sentence

Jun 16th, 2014
393
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.51 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <ctype.h>
  3.  
  4. int main()
  5. {
  6.         int ch;
  7.         int broken = 1;
  8.         ch = getchar();
  9.         while(ch != EOF) {
  10.                 if(broken && isalpha(ch)) {
  11.                         broken = 0;
  12.                         putchar(toupper(ch));
  13.                 } else {
  14.                         putchar(ch);
  15.                 }
  16.                 if(ch == '.' || ch == '\n' || ch == '\r') {
  17.                         broken = 1;
  18.                 }
  19.                 ch = getchar();
  20.         }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment