Intelligent Case Converter

Code Id 6
Date Updated 3/7/2010
Title Intelligent case converter  
Write a program that converts upper case to lower case, except at the beginning of a sentence,
where it converts lower case to upper case.Sentences begin (1) at the start of input, after any number of spaces and newlines,
and (2) following each period,after any number of spaces and newlines.

For example, if the user types
   this Is
   a test.  this
   is ONLY a test.
then your program will print
   This is
   a test.  This
   is only a test. 
Codes Snippet

int main(void)
  int startsentence = 1;
  char c;

  while (scanf("%c",&c) == 1) {
    if (startsentence)
    switch (c) {
      default: startsentence = 0; break;
      case '.': startsentence = 1; break;
      case ' ': case 'n': ;
  return 0;

Comments are closed.