# include <iostream.h>
# include<conio.h>
#include<string.h>
#include<stdio.h>
void main( )
{
char s[20], s1[20], *p = " ";
int i , count = 0;
cout<<"\n Input the String : \n";
gets(s);
strcpy(s1,s);
p = strtok(s1," ") ; // get the first word
for( i = 0 ;p;i++)
{
if (strcmp (p,"the") == 0 )
count++;
p = strtok(NULL," " ); //get the next word
}
cout<<"\n Count is : "<<count ;
}
0 comments:
Post a Comment