Listing 6

#include <ctype.h>
#include <string.h>

int ind=1,tmp=1;
int mat=1,spc;

main()
{
      char text[1024];

      getln(text);
      putln(text);
      printf ("Sentence is %d\n",ind);
      printf ("And has %d spaces in it\n",spc);
}
getln(text)
char *text;
{
      printf ("Enter Text : ");
      while((text[ind-1]=getchar())!='\n')
      {
             ind++;
      }
}

putln(text)
char *text;
{
      printf ("Text is    : ");

      while(text[tmp-1]!='\n')
      {
             if (mat==1)
             {
                    printf("%c",toupper(text[tmp-1]));
                    mat=0;
             }else{
                    printf("%c",tolower(text[tmp-1]));
             }
             if (isspace(text[tmp-1])) {
                    mat=1;
                    spc++;}
             if (text[tmp-1]=='.' || text[tmp-1]=='.') mat=1;
             tmp++;
      }
      printf("\n");
}

/* End of File */