The file contains the instructions. I need help by tonight. Please Help!!!!

main.cpp:

#include <iostream> 
#include <fstream>
#include "addressbook.h"
#include "addressbook.cpp"

int main(){

  ifstream inStream("input.txt");
  string line, header, token;
  vector <string> tokens;
  getline (inStream, header);
  AddressBook myAddressBook;
  while(!inStream.eof())
  {
      getline (inStream, line);
       cout << line << endl;
      int x=0, y=-1;
    while(x<line.length())
        {
              x = line.find_first_of ("\"", y+1);
          y = line.find_first_of ("\"", x+1);
         token = line.substr(x+1,y-x-1);
             tokens.push_back (token);
             cout << token <<endl;

    }


    }

system ("PAUSE");
return 0;
}

contacts.cpp:

#include "contacts.h"



Contact::Contact(std::string FirstName)
{
    firstname = FirstName;
}

Contact::Contact(std::string LastName)
{
    lastname = LastName;
}

Contact::Contact(std::string Nickname)
{
    nickname = Nickname;
}

Contact::Contact(std::string Email1)
{
    email1 = Email1;
}

Contact::Contact(std::string Email2)
{
    email2 = Email2;
}

Contact::Contact(std::string Phone1)
{
    phone1 = Phone1;
}

Contact::Contact(std::string Phone2)
{
    phone2 = Phone2;
}

Contact::Contact(std::string Address)
{
    address = Address;
}

Contact::Contact(std::string Website)
{
    website = Website;
}

Contact::Contact(std::string Birthday)
{
    birthday = Birthday;
}

Contact::Contact(std::string Notes)
{
    notes = Notes;
}


std::string Contact::getFirstName() {
    return firstname;
}

std::string Contact::getLastName() {
    return lastname;
}

std::string Contact::getNickname() {
    return nickname;
}

std::string Contact::getEmail1() {
    return email1;
}

std::string Contact::getEmail2() {
    return email2;
}

std::string Contact::getPhone1() {
   return phone1;
}

std::string Contact::getPhone2() {
   return phone2;
}

std::string Contact::getAddress() {
   return address;
}

std::string Contact::getWebsite() {
   return website;
}

std::string Contact::getBirthday() {
   return birthday;
}

std::string Contact::getNotes() {
   return notes;
}

contacts.h:

#include <string>
#include <vector>
using namespace std;

#ifndef _CONTACT_H_
#define _CONTACT_H_


class Contact {
public:
Contact(std::string FirstName, std::string LastName, std::string Nickname, std::string Email1, std::string Email2, std:: string Phone1, std::string Phone2, std::string Address, std::string Website, std::string Birthday, std:: string Notes);
std::string getFirstName() ;
std::string getLastName() ;
std::string getNickname() ;
std::string getEmail1() ;
std::string getEmail2() ;
std::string getPhone1() ;
std::string getPhone2() ;
std::string getAddress() ;
std::string getWebsite() ;
std::string getBirthday() ;
std::string getNotes() ;

private:
     std ::string firstname;
     std ::string lastname;
     std ::string nickname; 
     std ::string email1;
     std ::string email2; 
     std ::string phone1;
     std ::string phone2;
     std ::string address;
     std ::string website;
     std ::string birthday;
     std ::string notes;
}; 

#endif

addressbook.cpp

#include "addressbook.h"


AddressBook::AddressBook(){}

void AddressBook::addContact (Contact newContact)
{
      addressbook.push_back(newContact);
}

addressbook.h

#include "contacts.h"

#ifndef _ADDRESSBOOK_H_
#define _ADDRESSBOOK_H_



class AddressBook 
{
public:

AddressBook();  
void addContact (Contact newContact);


private:

    vector<Contact> addressbook;


};

#endif

Edited 4 Years Ago by stephanieirene

This article has been dead for over six months. Start a new discussion instead.