![]() |
strlen help...
Hi,
Im having a problem with an assignment...Im supposed to format a string...and this is doing my head in... I have to use a for loop, use strlen to control which character to format...the thing is, the first character in the string MUST be uppercase and the rest lowercase, and naturally, we have to use toupper and tolower... If you could provide even an example of how this would be implemented then I would be very happy... Thanks in advance |
|
This capitalizes all of the words in a string.
:
#include <stdlib.h>Sorry no strlen()... |
Some pseudo code for you to ponder:
For i = 0, while i is less then the length of the string, increment i by 1 per loop. If i is 0, change the letter to uppercase, otherwise change the letter to lowercase. Without writing the actual code for you, that should get you well on your way. |
| All times are GMT -5. The time now is 8:00 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC