So we should be something like this......
[code=cpp]
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main () {
string line;
string english;
int pos = string::npos; //initialise to invalid
cout << "Type the english words here, then press enter. Make sure to copy the words correctly. If you need to spell check use www.google.com" ;
cin >> english;
ifstream myFile ("c:\\eAh.txt") ;
if (myFile.is_open ())
{
while (! myFile.eof() )
{
getline (myFile,line);
pos = line.find(engli sh);
if(pos != string::pos)
{
cout <<"Word in line "<< line;
if(pos == 0)
{
cout << " Word in first position on line ";
}
}
}
myFile.close();
}
else cout << "Unable to open file";
}
[/code]
(I think this may be case sensitive, so apple != Apple
[code=cpp]
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main () {
string line;
string english;
int pos = string::npos; //initialise to invalid
cout << "Type the english words here, then press enter. Make sure to copy the words correctly. If you need to spell check use www.google.com" ;
cin >> english;
ifstream myFile ("c:\\eAh.txt") ;
if (myFile.is_open ())
{
while (! myFile.eof() )
{
getline (myFile,line);
pos = line.find(engli sh);
if(pos != string::pos)
{
cout <<"Word in line "<< line;
if(pos == 0)
{
cout << " Word in first position on line ";
}
}
}
myFile.close();
}
else cout << "Unable to open file";
}
[/code]
(I think this may be case sensitive, so apple != Apple
Comment