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 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, 24.06.2019 12:00
What is a sketch or blueprint of a web page that shows the structure (but not the detailed design) of basic page elements such as the logo, navigation, content, and footer?
Answers: 3
question
Computers and Technology, 24.06.2019 18:20
The following if statement contains a logic error, not a syntax error. rewrite it so that it is correct. assume the variable age already exists and holds a valid number. if (age == 18 & & age == 19) {
Answers: 1
question
Computers and Technology, 25.06.2019 00:00
Into which of these files would you paste copied information to create an integrated document? a. mailing list b. destination c. source d. data source
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, 18.08.2021 03:20
question
Health, 18.08.2021 03:20
Questions on the website: 13722362