Don't know why I keep getting error messages.
This is first the error message:

5 F:\DPR226\Homework\Customer\Customer.h:3, from main.cpp In file included from Customer.h:3, from main.cpp

Could anybody help please? Thanks

// main.cpp
#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;
#include "Customer.h"

int main(int argc, char *argv[])
{
    Customer newCustomer(12345, "Taylor Swift", "888 Oak Street.", " Media", 
                         "PA", "99999-1818", "666-111-6666", "None.", "Aaajjj@yahoo.com");
    newCustomer.print();
    cout << endl;                       
    
    system("PAUSE");
    return EXIT_SUCCESS;
}
//Customer.h
#include <string>
#include "Contact.h"
#include "Address.h"

#ifndef CUSTOMER
#define CUSTOMER
using namespace std;
class Customer
{
      private:              
          Contact cInfo;
          Address aInfo;
          int num;
          string name;  
          
      public:
             Customer(int, string, string, string, string, string, string, string, string);
             
             void setInfo(int, string, string, string, string, string, string, string, string); 
             void print() const;  
}


#endif
//Customer.cpp
#include <string>
#include <cstdlib>
#include <iostream>
#include <iomanip>
using namespace std;

#include "Customer.h"

Customer :: Customer(int numIn, string nameIn, string streetIn , 
                     string cityIn, string stateIn, string zipIn, 
                     string phoneIn, string faxIn, string emailIn)
          : aInfo( streetIn, cityIn, stateIn, zipIn), cInfo(phoneIn, faxIn, emailIn) 
{
          num = numIn;
          name = nameIn;                                          
}
             
void Customer :: setInfo(int numIn, string nameIn, string streetIn,          
                        string cityIn, string stateIn, string zipIn, 
                        string phoneIn, string faxIn, string emailIn)
{
     aInfo.setAddress(streetIn, cityIn, stateIn, zipIn);
     cInfo.setContact(phoneIn, faxIn, emailIn);
     num = numIn;
     name = nameIn;                             
}               
       
void Customer :: print() const
{
     cout << "Customer: " << num << endl;
     cout << "          " << name << endl;
     cout << "          " ;
     aInfo.print();
     cout << endl;
     cout << "          ";
     cInfo.print();
     cout << endl;
     
 }  
//Address.h
#ifndef ADDRESS
#define ADDRESS
#include <string>
using namespace std;
class Address
{
      private:
              string street;
              string city;
              string state;
              string zip;
              
      public:
             Address (string, string, string, string );
             
             void setAddress(string, string, string, string);
             
             string getStreet() {return street;}
             string getCity()   {return city;}
             string getState()  {return state;}
             string getZip()    {return zip;} 
              
             void print() const; 
              
}

#endif
//Adress.cpp
 #include <iostream>
 #include <cstdlib>
 #include <string>
 using namespace std;
 
 #include "Address.h"
 
  Address :: Address (string streetIn, string cityIn, string stateIn, string zipIn)
{
              setAddress(streetIn, cityIn, stateIn, zipIn);
}
             
void Address :: setAddress(string streetIn, string cityIn, string stateIn, string zipIn)
{
     street = streetIn;
     city = cityIn;
     state = stateIn;
     zip = zipIn;
 }          
             
            
              
 void Address print() const
 {
      cout << street << endl;
      cout << city << ", " << state << " " << zip << endl;
  } 
//Contact.h
#ifndef CONTACT
#define CONTACT
#include <string>
using namespace std;
class Contact
{
      private:
              string phone;
              string fax;
              string email;
              
      public:
             Contact(string, string, string);
             
             void setContact(string, string, string);
             
             string getPhone() {return phone;}
             string getfax()   {return fax;}
             string getEmail()  {return email;} 
             
             void print() const; 
}

#endif
//Contact.cpp
#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;

#include "Contact.h"

Contact :: Contact(string phoneIn , string faxIn , string emailIn)
{
        setContact(phoneIn, faxIn, emailIn);        
}
             
void Contact :: setContact(string phoneIn, string faxIn, string emailIn)
{
     phone = phoneIn;
     fax = faxIn;
     email = emailIn;
 }            
              
void Contact :: print() const
{
     cout << "Phone: " << phone << endl;
     cout << "Fax: " << fax << endl;
     cout << "E-mail " << email << endl; 
 }

Recommended Answers

All 2 Replies

Please the "using" directive after all include files. Like this:

#
#include "Customer.h"
using namespace std;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.