All pastes #499359 Raw Edit

Mine

public text v1 · immutable
·published 2007-05-21 00:43 UTC
rendered paste body
// Final Project
// Programmer: Michael William
// Editor used: Pad
// Compiler used: VC++ 2005 Professional
//

#include <iostream>
#include <fstream> 
#include <string>
#include <deque>
using namespace std;

struct mail
{
  string lineFromFile;
  string address;
};

int main()
{
  string File; 
  cout << "Enter the name of the file to be opened: ";
  getline(cin, File);
  ifstream fin;
  fin.open(File.c_str());
  if(!fin.good()) throw "I/O error";
 
  if(File.length() < 0)
    fin.open("fileContainingEmails.txt");

  deque<string> myDeque;

  while(fin.good())
  {
    string lineFromFile;
    fin >>lineFromFile;
    getline(fin, lineFromFile);
    myDeque.push_back(lineFromFile);
  }

  int i,j;
  string checker = "tell@dfd.ere"; // i just made this to check, it works, 
  int countMail = 0;
  string eMail;
/*  for(i = 0; i < 12; i++) I assume this is 12 for 'checker's length?
  {
    if(checker[i] == '@')// change this to myDeque[i] == '@'
     cout << "hey " << endl;
    
  }
*/
    for(i=0;i<myDeque.size();i++) {
        for(j=0;j<myDeque[i].size();j++) {
            if(myDeque[i][j] == '@')
                cout << "hey" << endl;
        }
    }

  cout << "" << endl;
  cout << countMail << " email addresses where found! " << endl;
  cout << "" << endl;

  if(countMail > 0)
  {
    ofstream fout;
    string outFile;
    cout << "Where are these email addresses to be sent: " << endl;
    getline(cin,eMail);
    fout.open(outFile.c_str());
    
    if(outFile.length() < 0)
    fout.open("copyPasteMyEmails.txt");
  }

  return 0;
}