Question
------->(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
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started