/*******************************
* Program to convert each word's *
* first character into upper case *
*******************************/
#include
#include
void main()
{
int k=1,i=0;
char str[100];
clrscr();
printf("enter any string");
gets(str);
while(str[i]!='\0')
{
if(k>0)
{
str[i]=str[i]-32;
k=0;
}
if(str[i]==' ')
{
k=1;
}
i++;
}
puts(str);
getch();
}
* Program to convert each word's *
* first character into upper case *
*******************************/
#include
#include
void main()
{
int k=1,i=0;
char str[100];
clrscr();
printf("enter any string");
gets(str);
while(str[i]!='\0')
{
if(k>0)
{
str[i]=str[i]-32;
k=0;
}
if(str[i]==' ')
{
k=1;
}
i++;
}
puts(str);
getch();
}
No comments:
Post a Comment