is this an assignment for a C++ class? or something you're really trying to do in real life?
if this is a real application, I'd say you're using the wrong language and you should seriously consider Perl. Perl was made for this problem.
you'd have a complete solution that parses validated email addresses from a file in about 4 or 5 total lines of code.
.