Code:
#include <stdio.h>
#include <string.h>
#define true 1
#define false 0
void capitalize(char *paragraph){
char outBuffer[2048]; int c = 0;
char this = '\0'; int capThis = true, skip = false;
for (int i=0; i < strlen(paragraph); i++) {
switch(this = paragraph[i]) {
case '.':
capThis = true;
break;
default:
if (capThis && (this != ' ')) {
capThis = false;
if ( ((this - 32) < 91) && ((this - 32) > 64) ) {
this = (this - 32);
}
}
break;
}; if (!skip) outBuffer[c++] = this;
}
outBuffer[c++] = '\0';
printf("%s",outBuffer);
}
int main(int argc, char *argv[]) {
capitalize( "the first letter... of each sentence." );
return 0;
}