First of all I admit that I am just learning C++.
I have been working on this all day and seem to be getting nowhere. Directions are to take information from file mail.dat and put it into file addresses.dat. Have the mail.dat file made which says:
From: Sharon@marzipan.edu
Date: Wed, 13 Oct 2013 20;31;00 EDT
Subject: Re: HELLO
To: john@meringue.com
John,
Dave's email is dave_smith@icing.org.
ttyl,
sharon
Addresses.dat should have only the email address.
Sharon@marzipan.edu
john@meringue.com
dave_smith@icing.org
I have it set up to know if my file are working. Also, at one time had the coding to let me see the three @ so I knew I was working in the correct direction.
What I am not understanding is how to get only the email address out of all the other information. The way my coding is at them moment I have all the information but do not know how to go about getting my results.
Some help would be appreciated.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
char Char = '@';
ifstream inFile;
ofstream outFile;
string line;
inFile.open("mail.dat");
if (!inFile)
{
cout << "Can't open input File" << endl;
cin.get();
return 1;
}
if (inFile)
cout << "Opened file and locating Information. One moment Please!"<< endl;
inFile >>line;
while (inFile)
{
getline(inFile,line);
cout << line << endl;
}
inFile.close();
system("pause");
return 0;
}
|
It may be a mess as I have been working different idea to see the results, but at this time I am stumped.
thank you