Can anybody help me on how to search a keyword in my text file. I read about eliza420 Thread but still don't get it.

If i have a text file named. "animals.txt" with a content of,
-------------------------------------------------------------------
Fish
Pig
Dog
Goat
Bird
-------------------------------------------------------------------
and in my c++ program a question will ask the user,
cout<<"Enter a animal: "<<endl;
will promt like this.
-------------------------------------------------------------------
Enter a animal: Dog
-------------------------------------------------------------------
When the user enters a Dog then the c++ program will search the keyword "Dog" from the text file "animals.txt".
If the keyword exist then it will promt as
-------------------------------------------------------------------
Enter a animal: Dog
Animal Dog found in our text file.
-------------------------------------------------------------------
if keyword not found in the list then it will promt as
-------------------------------------------------------------------
Enter a animal: Dog
Animal Dog not found in our text file.
-------------------------------------------------------------------


My problem is how to code this one. I know it's a quest simple problem. but i'm also a newbie about c++ coding.

Thank you,

Post your code.. we'll tell you what's wrong with it..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.