#include "stdafx.h"
#include <fstream>
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
const int len=81;
char word[len], line[len];
cout <<"Vvedite clovo dla poiska "; cin >>word;
int l_word=strlen(word);
ifstream fin("text.txt", ios :: in );
if (!fin) {cout <<"Don't worry!!!!"<<endl; return 1;}
int count = 0;
while (fin.getline(line,len)){
char *p=line;
while (p=strstr(p,word)){
char *c=p;
p+=l_word;
if (c!=line)
if (!ispunct(*(c-1)) && !isspace(*(c-1))) continue;
if (!ispunct(*p) || !isspace(*p) || (*p == '\0')) count++;
}
cout <<"Kolichestvo vhogdenui slova "<<count<<endl;
}
return 0;
}