Created
October 2, 2013 17:43
-
-
Save nkt/6797529 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 <iostream> | |
#include <string.h> | |
using namespace std; | |
int main() | |
{ | |
char in[101]; | |
char sub[31]; | |
cout<<"Введи строку: "; | |
cin.getline(in, 101); | |
cout<<"Введи слово: "; | |
cin>> sub; | |
int count = 0; | |
int len = strlen(sub); | |
for(char *p = in; (p = strstr(p, sub)); p+=len){ | |
++count; | |
} | |
cout << count << "\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment