if you want to just capitalise the first letter of the sentence then do this:
Code:
#include <ctype.h>
void Capitalize(char* sentence)
{
if(sentence && strlen(sentence) > 0)
{
sentence[0] = toupper(sentence[0]);
}
}
if you need to do the first letter of every word in the sentence then do this:
Code:
#include <ctype.h>
void Capitalize(char* sentence)
{
int i = 0;
int length;
if(sentence && strlen(sentence) > 0)
{
length = strlen(sentence);
while(i < length)
{
if(sentence[i] == ' ' && i < length - 1)
{
sentence[i + 1] = toupper(sentence[i + 1]);
}
i++;
}
}
}
hope this helps!
U.