Showing posts with label first letter in word to caps. Show all posts
Showing posts with label first letter in word to caps. Show all posts

Tuesday, October 13, 2009

first letter in word to caps

#include
#include
#include
/* Write a Program to in which
* the given strings like str []
* ="second week test exercise" should be outputted as
* “Second Week Test Exercise”.
* WITOUT USING ANY STANDARD FUNCTION*/
int main()
{
char str[]="second week test exercise";
int i=0;
int j=0;
while(str[i]!='\0')
{
i++;
}
printf("length of the string %d \n",i);
str[0]=str[0]-32;
while(j<=i)
{
if(str[j]==' ')
{
str[j+1]=str[j+1]-32;
}j++;
}
printf("%s",str);
getch();
return 0;
}