subject

Write a program whose input is an email address, and whose output is the username on one line and the domain on the second. example: if the input is:

pooja@piazza. com

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 .

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 < < " 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;
}

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 07:30
Jasper and samantha are in a robotics competition. the guidelines state that the robots should be able to move a 10-gram weight at least 2 meters and turn in a circle. jasper and samantha have already built the robot. which step of the design process should they follow next to decide whether their robot meets the minimum criteria for the competition?
Answers: 1
question
Computers and Technology, 24.06.2019 00:20
The guy wire bd exerts on the telephone pole ac a force p directed along bd. knowing the p must have a 720-n component perpendicular to the pole ac, determine the magnitude of force p and its component along line ac.
Answers: 2
question
Computers and Technology, 24.06.2019 14:00
Which computer tools allow you to communicate with coworkers, family,and friends
Answers: 1
question
Computers and Technology, 24.06.2019 14:30
Which computer network component connects two different networks together and allows them to communicate? a is a node (or a device) that connects two different networks together and allows them to communicate.
Answers: 1
You know the right answer?
Write a program whose input is an email address, and whose output is the username on one line and th...
Questions
question
Mathematics, 27.02.2021 05:00
question
Mathematics, 27.02.2021 05:00
question
Biology, 27.02.2021 05:00
question
Mathematics, 27.02.2021 05:00
question
Mathematics, 27.02.2021 05:00
Questions on the website: 13722360