ple: if the input is:
[email protected]
Then the output is
username: pooja
domain: piazza.com
The main program is written for you, and cannot be modified. Your job is to write the function parseEmailAddress defined in "util.cpp" The function is called by main() and passed an email address, and parses the email address to obtain the username and domain. These two values are returned via reference parameters. Hint: use the string functions .find() and .substr(),
main.cpp is a read only file
#include
#include
using namespace std;
// function declaration:
void parseEmailAddress(string email, string& username, string& domain);
int main()
{
string email, username, domain;
cout << "Please enter a valid email address> ";
cin >> email;
cout << endl;
parseEmailAddress(email, username, domain);
cout << "username: " << username << endl;
cout << "domain: " << domain << endl;
return 0;
}
/*util.cpp*/ is the TODO file
#include
#include
using namespace std;
//
// parseEmailAddress:
//
// parses email address into usernam and domain, which are
// returned via reference paramters.
//
void parseEmailAddress(string email, string& username, string& domain)
{
//
// TODO: use .find() and .substr()
//
username = "";
domain = "";
return;
}