I want to analyze the content of a text file & search for a string in the file.
It is assumed a sentence is terminated by a , . ; ? !
This is what i have so far
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream fin;
char filename[30];
char buffer[255];
size_t found;
string s;
string str;
size_t found;
cout << "Enter filename (including .txt): ";
cin >> filename;
cout <<"Word to search for: ";
cin >> buffer;
fin.open(filename);
if (!fin.good())
{
cout << "File not found" << endl;
return 1;
}
while(!fin.eof())
{
found=str.find_first_of(".,?;!");
// use getline to read entire line
getline(fin, s);
cout << found << endl;
}
fin.close();
system("pause");
return 0;
}
Can someone help me please