Can't get it to read my file?

#include <iostream>
#include <fstream>

using namespace std;

int main()
{
ifstream inFile;
int even=0,odd=0,x,y;
inFile.open ("hw4dataf11.txt");
if(inFile.fail()) //is it ok?
{ cout<<"file did not open please check it\n";
system("pause");
return 1;
}
inFile>>x;
while(!inFile.eof())
{y=x%2;
if (y==0)
even++;
if (y==1)
odd++;
inFile>>x;
}
cout<<"Number of even numbers "<<even<<endl;
cout<<"Number of odd numbers "<<odd<<endl;
system("pause");
return 0;
}

Anyone no why I can't get it to read my file? Any help would be appreciated

thanks
Do you see the error message "file did not open please check it"?
Topic archived. No new replies allowed.