C++ count word

This is the exercise: Write a program that will ask the user to enter word. Your program will open a file that has 25 words in it. It will call a function that returns HOW MANY of the words in the file are exactly the word that the user put in.

My teacher did it just like that but my Mac doesn't want to count the works plz help!!!!! What am I doing wrong!







#include<iostream>
#include <fstream>
#include<string>


using namespace std;
int main()
{

int count=0;
string word;
string can;
ifstream inData("C:/Users/wendy/Desktop/myfile.txt"); //opening text file

inData.open("C:/Users/wendy/Desktop/myfile.txt");
cout<<"FILE FOUND"<<endl;

cout<<"Enter a word to count: ";
cin>>word;


while(!inData.eof())
{

if (word==0
count++;
}

cout<<"Occurrence="<<count<<endl;
inData.close(); //closing file

return 0;

}
Registered users can post here. Sign in or register to post.