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.

The symbol @ must occur exactly once. For example, bar.cs.dpu.edu
and bar@cs@dpu.edu are not valid email addresses.

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.

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.

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:

In order to simplify the logic, make each of the four conditions a function (see below).

Write all functions using the pointer (*) notation ONLY. So the prototypes would be:

bool oneAt(const char* email);

bool nonblankAt(const char* email);

bool oneDot(const char* email);

bool nonblankDot(const char* email);

Note: YOU SHOULD NEVER use the []
notation, NOWHERE in the functions. Use pointers only
or pointer arithmetic instead.

Input data (email addresses) must come from an input file, where an
email address is indicated in one line. You can use this input file,
"em1.txt".
Put it in the same directory as your source code. It
contains lines such as:

To read from an input file, you can use the following skeleton code.
You can add lines or variables as you wish.

#include <iostream>
#include <fstream> // for ifstream
#include <cstdlib> // for exit()
#include <cstring> // for string-handling functions
using namespace std;
// prototypes
//....
int main()
{
char filename[16];
ifstream fin;
/* Receive input file name as input. */
cout << "Enter the input file: ";
cin >> filename;
/* Open the input file for reading. If error, exit the program. */
fin.open(filename);
if (fin.fail()) {
cerr << "Input file opening error.\n";
exit(1);
}
/* Declare some variables. */
const int SIZE = 50; // should do for this program
char line[SIZE];
/* Process one line at a time */
// Read the first line from the input file
fin.getline(line, SIZE);
// Process loop
while (strlen(line) != 0) // as long as the line is not blank
{
//
// Do the necessary task for the current line
//
// Read the next line from the input file
fin.getline(line, SIZE);
}
/* Close the input file before exit. */
fin.close();
system("pause");
return 0;
}

NOTE: The C++ function getline(), used with cin, is
explained in the textbook (textbook p. 379-).
It works with a file input stream as well ('fin' in the code above).
It reads one entire line from the source input stream (where the maximum
number of characters to be read is passed in as the 2nd argument), and
place/copy the line in the char array (passed in as the 1st argument) with
the last '\n' character replaced by '\0' -- thereby making the char array a
cstring.

As in the example code above, ask the user for the name of the input file, just like the textbook sample
program. This is to make your program more flexible.

Be sure to close the file at the end of the program.

If you detect an invalid entry, display to the terminal the entry and its
line number. Here is an example run for the "em1.txt".