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, 23.06.2019 07:10
If you want to import a picture into a dtp application, what must you do first? draw an image frame. import text. open the folder containing the file. select get image… from the windows menu.
Answers: 2
question
Computers and Technology, 24.06.2019 11:00
Need fast im timed in a paragraph of 125 words, explain at least three ways that engineers explore possible solutions in their projects.
Answers: 2
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
question
Computers and Technology, 24.06.2019 14:30
Ahousehold consists of a married couple and their twin five-year old daughters. the couples children had no income and lived with their parents all of last year. how many exemptions can the couple claim on last years tax return or they file with the “ married filing jointly “ status? a. 4 b. 5 c. 3 d. 2
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, 22.01.2022 23:50
question
Advanced Placement (AP), 22.01.2022 23:50
question
Geography, 22.01.2022 23:50
question
History, 22.01.2022 23:50