Question
You are working for a company that's building an email listfrom files of mail messages. They would like you to wirte a programthat reads a file called mail.dat and that ouputs every string withan @ sign in it to file addresses.dat. For the purpose ofthis project a string is definedas it is by the C++ stream reader-acontiguous sequence of non white space characters. Given thedata: From:
sharon@marzipan.edu Date: wed. 13 Aug 2003 17:12:33EDT Subject: Re: Hi To:
john@meringue.com john, Dave's email is
dave_smith@icing.org. ttyl. sharon Then the program should output on file addresses.dat:
sharon@marzipan.edu john@meringue.com dave_smith@icing.org. Use meaningful variable names, proper indentions andappropriate comments You are working for a company that's building an email listfrom files of mail messages. They would like you to wirte a programthat reads a file called mail.dat and that ouputs every string withan @ sign in it to file addresses.dat. For the purpose ofthis project a string is definedas it is by the C++ stream reader-acontiguous sequence of non white space characters. Given thedata: From:
sharon@marzipan.edu Date: wed. 13 Aug 2003 17:12:33EDT Subject: Re: Hi To:
john@meringue.com john, Dave's email is
dave_smith@icing.org. ttyl. sharon Then the program should output on file addresses.dat:
sharon@marzipan.edu john@meringue.com dave_smith@icing.org. Use meaningful variable names, proper indentions andappropriate comments
Explanation / Answer
please rate - thanks #include #include #include using namespace std; int main() {int j,last,first,found,i; string input; ifstream in; ofstream out; in.open("mail.dat"); if(in.fail()) //is it ok? { cout