There's no return statement in the occur function - looks like you meant to return an integer value?
Edit: Doesn't look like it's getting into the while loop. cin stops at blank spaces. If you want someone to be able to enter more than one word - check into using getline instead of cin.
I don't know what to say, I have rosy cheeks now (for the return statement. As for the second point, I currently don't need to be able to input string with whitespace...