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 <fstream>

using namespace std;
int main()

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

cout<<"FILE FOUND"<<endl;

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


if (word==0

inData.close(); //closing file

return 0;

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