Hello,
I am in need of some major help.
I need to write a C 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
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.Code:#include <stdio.h> int main() { int i = 0; char c, lower_c; printf("Enter text\n"); c = getchar(); while (c != '\n' && c >= 0) { if (c >= 'A' && c <= 'Z') lower_c = c + 32; else lower_c = c; putchar(lower_c); c = getchar(); }
If anybody could help me out with this, it would be much appreciated.
Thank you for all your help in advance.
(PS I posted this thread earlier, but really didn't get much help. The one person posted a complete code, but that does not help me to understand(doesn't even work right!), and the others didn't give me insight as to if I was going to the right direction or how to proceed)