void main()
{
char a[100];
int i=0,j=0,n[10],wn=0,count=0,n1[10] = {0,0,0,0,0,0,0,0,0,0},n2;
clrscr();
printf("\n PLEASE END THE STRING BY USING ( . ) SYMBOL TO GET THE CORRECT OUTPUT\n\n ");
gets(a);
while(a[i] != '\0')
{
if(a[i] == ' ' || a[i] =='.')
{
n[j] = i-wn;
wn = i+1;
j++;
count++;
}
i++;
}
cout <<"\n NUMBER OF WORDS : "<<
for(i=0;i < count;i++)
{
n2 = n[i];
n1[n2]++;
}
for(i=1;i < 10;i++)
{
cout << "\n NUMBER OF "<< i <<" LETTER WORD : " <
}
getch();
}
INPUT
PLEASE END THE STRING BY USING ( . ) SYMBOL TO GET THE CORRECT OUTPUT
I AM HAPPY.
(END THE STRING WITH . SYMBOL)
OUTPUT WILL BE LIKE THIS
NUMBER OF 1 LETTER WORD 1
NUMBER OF 2 LETTER WORD 1
NUMBER OF 3 LETTER WORD 0
NUMBER OF 4 LETTER WORD 0
NUMBER OF 5LETTER WORD 1
NUMBER OF 6 LETTER WORD 0
No comments:
Post a Comment