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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 18:00, alyssacyamamoto8050
Budgets you to do all of the following expect a) send frivolously b) avoid over spending c) gain financial independence d) examine your priorities and goals
Answers: 2
image
Computers and Technology, 22.06.2019 23:50, Crull5999
List a few alternative options and input and output over the standerd keyboard and monitor. explain their functioning in details.
Answers: 2
image
Computers and Technology, 23.06.2019 14:30, HarryPotter10
Open this link after reading about ana's situation. complete each sentence using the drop-downs. ana would need a minimum of ato work as a translator. according to job outlook information, the number of jobs for translators willin the future.
Answers: 3
image
Computers and Technology, 23.06.2019 19:30, alangonsales6232
2. fluorine and chlorine molecules are blamed fora trapping the sun's energyob forming acid rainoc producing smogod destroying ozone molecules
Answers: 2
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 in other subjects:

Konu
Mathematics, 04.03.2021 20:10