NEED HELP! make first letter of each word in user input text uppercase
Hello,
I am in need of some major help.
I need to write a program to make the user input some text,
and the first letter of each word has to be uppercase.
(have to use while loops)
So for example lets say the user inputs:
i lOvE pRoGrAmMiNg
The output needs to be:
I Love Programming
Code:
int main()
{
char c, lower_c;
printf("Enter Text\n");
while (c != '\n' && c >= 0)
{
if (c >= 'A' && c <= 'Z')
lower_c = c + 32;
else
lower_c = c;
putchar(lower_c);
c = getchar();
}
putchar('\n');
return 0;
}
I have started this code by making the letters lowercase (I don't know if this was the right way to approach this, but I am hoping you can help me with that). I am not sure how proceed after this step, the step of making the first letter uppercase.
If anybody could help me out with this, it would be much appreciated.
Thank you for all your help in advance.
(PS for the program, loops should be while loops)