A PROGRAM TO IMPLEMENT SENTENCS CASE Array String
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<ctype.h>
# define INDEX 80 /* MAX ARRAY LENGTH=80 */
void main(void)
{
char string[INDEX];
int length,i;
clrscr();
puts("ENTER THE STRING\n");
gets(string);
length=strlen(string); /* CHECKING MAX STRING LENGTH */
string[0]=toupper(string[0]);
for(i=1;i<=length;i++)
{
string[i]=tolower(string[i]); /* CONVERT ENTIRE STRING TO LOW CASE */
}
for(i=1;i<=length;i++)
{
if(string[i]=='.')
string[i+1]=toupper(string[i+1]); /* UPPER CASE CONVERSION AFTER '.' */
}
puts(string);
printf("THE LENGTH OF THE STRING WAS %d",length);
getch();
}
0 comments:
Post a Comment