How to compare a string with file's content?

Hi,

I am a beginner in c++. I have a file 'Names.txt' which contain a list of names.
ex:
Amar
Aruna
Ben
Guru
Yamini
etc..

This is my pseudo code:

function Validate()
{
read file contents
display to console
ask user to pick one of the above names
compare the user entered name with names in file
if matches print success
else repeat the steps until user chooses correct name.
}

Thanks in advance.
Topic archived. No new replies allowed.