Last active
December 25, 2015 17:19
-
-
Save MaratB/7011838 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <conio.h> | |
main(){ | |
char s[80], word[30]. | |
*p; | |
int count=0, len; | |
printf("Enter sentence: %s\n", s ); | |
gets(s); | |
printf("Enter word: %s\n", word ); | |
gets (word); | |
len = strlen(word); | |
p = s; | |
while(1){ | |
p = strstr(p, word); | |
if (p==0) break; | |
p = p+len; | |
count++; | |
} | |
printf(" %d %s in this sentence\n", count, word ); | |
getch(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment