Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

------->(IN C++) Write a program whose input is the name of a file that contains valid email addresses, one per line. The program then parses

------->(IN C++)

Write a program whose input is the name of a file that contains valid email addresses, one per line. The program then parses and outputs each domain and username. Example: suppose the file "input1.txt" contains

pooja@piazza.com drago12@uic.edu javiar_g@hotmail.com 

If the program is given the filename "input1.txt", the program outputs the following to the console:

piazza.com, pooja uic.edu, drago12 hotmail.com, javiar_g 

Your solution should use the parseEmailAddress function written in the previous exercise. If the input file does not exist, output "**file not found", otherwise process the contents of the input file; assume the input file contains one or more valid email addresses.

given input:

// // HW #02-3: program to parse a file containing email addresses, outputting the // domains and usernames. //

#include #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: // username = ""; domain =""; return; }

int main() { string filename; cout << "Please enter a filename> "; cin >> filename; cout << endl; // // TODO: //

return 0; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Neo4j Data Modeling

Authors: Steve Hoberman ,David Fauth

1st Edition

1634621913, 978-1634621915

More Books

Students also viewed these Databases questions

Question

3. Define the attributions we use to explain behavior

Answered: 1 week ago