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 10:30
You have a large, late-model pick-up truck with a rear seat. the pick-up truck weighs 6,500 pounds. the florida seat belt law
Answers: 1
question
Computers and Technology, 23.06.2019 05:30
Sally is editing her science report about living things. she needs to copy a paragraph from her original report. order the steps sally needs to do to copy the text to her new document.
Answers: 1
question
Computers and Technology, 23.06.2019 09:00
Which is the highest level of the hierarchy of needs model? a. humanity b. intrapersonal c. team d. interpersonal
Answers: 1
question
Computers and Technology, 23.06.2019 10:50
The volume v and paper surface area a of a conical paper cup are given by where r is the radius of the base of the cone and h is the height of the cone. a. by eliminating h, obtain the expression for a as a function of r and v. b. create a user-de ned function that accepts r as the only argument and computes a for a given value of v. declare v to be global within the function. c. for v ! 10 in.3 , use the function with the fminbnd function to compute the value of r that minimizes the area a. what is the corresponding value of the height h? investigate the sensitivity of the solution by plotting v versus r. how much can r vary about its optimal value before the area increases 10 percent above its minimum value?
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
Computers and Technology, 15.07.2020 20:01
question
Social Studies, 15.07.2020 20:01
Questions on the website: 13722361