The program must use a fixed array of AdressBook objects and size it to 1000 elements. The code should look like this:
const int ADDR_BOOK_SZ = 1000;
AdressBook addrBook[ADDR_BOOK_SZ];
This application should display a console menu that looks like this:
Open an address book file
Add a new address book entry
Print the contents of current address book
Quit
When a) is selected, the program prompts the user to enter a file path for the address book file. It should open the file, read in the 7 lines of data for each entry into the next element of addrBook array. Reading of the file should continue until there are no more entries left in the file.
The b) option should prompt the user to enter the 7 lines for a new address book entry contained within the AddEntryFromConsole() method. This method should first check to see if an address book file has been opened yet through selection a). A function in the main function should also verify that the address book entry does not already exist by using the overloaded “==” operator. If it does not already exist, add that entry to the next element in the addrBook array using the overloaded assignment operator, ‘=’, and also append it to the address book file using the AppendToFile() method.
The c) option should print the current contents of the address book array, which should match the contents of the address book file. It should also print the number of entries currently contained.
Ok, so that's the task, and as for my question I seem to have difficuly refering to things like #include "AddressBook.h", I'll let you see the code I have:
AddressBook.cpp:5: error: definition of implicitly-declared `AddressBook::AddressBook()'
AddressBook.cpp:5: error: declaration of `AddressBook::AddressBook()' throws different exceptions
AddressBook.h:8: error: than previous declaration `AddressBook::AddressBook() throw ()'
AddressBook.cpp:9: error: no `AddressBook::~AddressBook()' member function declared in class `AddressBook'
AddressBook.cpp:13: error: prototype for `void AddressBook::SetFirstName(std::string)' does not match any in class `AddressBook'
AddressBook.h:23: error: candidate is: void AddressBook::SetFirstName(const char*)
AddressBook.cpp: In member function `void AddressBook::SetFirstName(std::string)':
AddressBook.cpp:14: error: `first_' undeclared (first use this function)
AddressBook.cpp:14: error: (Each undeclared identifier is reported only once for each function it appears in.)
AddressBook.cpp: At global scope:
AddressBook.cpp:18: error: prototype for `std::string AddressBook::GetFirstName()' does not match any in class `AddressBook'
AddressBook.h:34: error: candidate is: void AddressBook::GetFirstName(char*, int) const
AddressBook.cpp: In member function `std::string AddressBook::GetFirstName()':
AddressBook.cpp:19: error: `first_' undeclared (first use this function)
AddressBook.cpp: At global scope:
AddressBook.cpp:23: error: prototype for `void AddressBook::SetLastName(std::string)' does not match any in class `AddressBook'
AddressBook.h:24: error: candidate is: void AddressBook::SetLastName(const char*)
AddressBook.cpp: In member function `void AddressBook::SetLastName(std::string)':
AddressBook.cpp:24: error: `last_' undeclared (first use this function)
AddressBook.cpp: At global scope:
AddressBook.cpp:28: error: prototype for `std::string AddressBook::GetLastName()' does not match any in class `AddressBook'
AddressBook.h:35: error: candidate is: void AddressBook::GetLastName(char*, int) const
AddressBook.cpp: In member function `std::string AddressBook::GetLastName()':
AddressBook.cpp:29: error: `last_' undeclared (first use this function)
AddressBook.cpp: At global scope:
AddressBook.cpp:33: error: no `void AddressBook::SetId(long int)' member function declared in class `AddressBook'
AddressBook.cpp: In member function `void AddressBook::SetId(long int)':
AddressBook.cpp:34: error: `id_' undeclared (first use this function)
AddressBook.cpp: At global scope:
AddressBook.cpp:38: error: no `long int AddressBook::GetId()' member function declared in class `AddressBook'
AddressBook.cpp: In member function `long int AddressBook::GetId()':
AddressBook.cpp:39: error: `id_' undeclared (first use this function)
AddressBook.cpp: At global scope:
AddressBook.cpp:43: error: no `void AddressBook::Populate()' member function declared in class `AddressBook'
AddressBook.cpp: In member function `void AddressBook::Populate()':
AddressBook.cpp:45: error: `first_' undeclared (first use this function)
AddressBook.cpp:48: error: `last_' undeclared (first use this function)
AddressBook.cpp:51: error: `id_' undeclared (first use this function)
you haven't declared the constructor/destructor and defining one.
check your declarations of the functions... like your function SetFirstName takes char and you you defining it with a string type. inside that function first_ is not a member, instead firstName_ is the member of the class.. and thats a char type.
all the errors are of these type only. i correct one of your error rest you try your self.