Pseuocode:
Open file with fstream object(ofstream/ifstream).
Read in every work(fstream_object >> variable, Note doesn't work on every line)
Then if the variable equals what you are searching for output.
Example:
#include <iostream>
#include <fstream>
using namespace std;
int main(){
ifstream data;
data.open("file.txt")
string var;
while(data){
indata >> var;
if(var == "mouse" || var == "cat" || var == "lion")
cout << var;
}
return 0;
}</fstream></iostream>
And this may have some typos, for i did not check it but this is basically what it should look like.
And next time just google some fstream tutorials for c++.
Good Luck!!!