CSC 309/404 C++
Homework #3
with UPDATE 10/22 (Wed) after class
Due: October 29 (Wed), 11:59 pm

Program: ("EmailChecker.cpp")

Write a program that reads in an email address, such as tomuro@cs.depaul.edu, and checks for its validity.  For the purpose of the program, an email address is valid if it satisfies all of the following four conditions.

NOTE: Those rules are arbitrary, and do not reflect the industry standard in the real world.  Do not be concerned about it.  Just implement what's given.

  1. The symbol @ must occur exactly once.  For example, bar.cs.dpu.edu and bar@cs@dpu.edu are not valid email addresses.
  2. There must be an alpha-numeric symbol (letters or digits; no other symbols) immediately to the left of the @ sign.  For example, blue!@yahoo.com or @cs.dpu.edu are not valid email addresses, while blue!3@yahoo.com and blue!3@#yahoo.com are valid email addresses.
  3. There must be at least one . in the email address.  For example, bar@cs is not a valid email address, while bar@cs.dpu and bar.cs.dpu@ are valid email addresses.
  4. Every occurrence of the symbol . must have an alpha-numeric symbol (letters or digits; no other symbols) immediately on the both sides of the . symbol.  For example, bar@c#.depaul.edu and bar@cs.~depaul.edu and bar@cs. and .bar@depaul are not valid email addresses.

Implementation Requirements:

 

Enter the input file: em1.txt

*** INVALID ENTRIES ***
5: .m.a.alam@bristol.ac.uk
7: amar@igcar
12: rumenia @rusys.eg.net
13: jeremie@debaerdermaeker@rug.ac.be
15: bba@neu-.edu
18: CDBELING.hkucc
21: @boerner@physik.uni-halle.de
23: BORONSKI@apollo.int.!pan.wroc.pl
26: DTB@physci.uct.ac.

Submission

Submit the source file (EmailChecker.cpp) on D2L as usual.