Having trouble with ADT's, Overloading, and Classes together

I'm trying to create an address book application, and HAS to use this AddressBook class and header file (unaltered):

const int ENTRY_SZ = 256;

class AddressBook

{

private:

char firstName_[ENTRY_SZ];

char lastName_[ENTRY_SZ];

int streetNum_;

char streetName_[ENTRY_SZ];

char city_[ENTRY_SZ];

char state_[ENTRY_SZ];

int zipCode_;


public:


static int entryCnt;

static char filePath[ENTRY_SZ];


void SetFirstName(const char fName[]);

void SetLastName(const char buff[]);

void SetStreetNum(const char buff[]);

void SetStreetNum(int num);

void SetStreetName(const char buff[]);

void SetCity(const char buff[]);

void SetState(const char buff[]);

void SetZipCode(const char buff[]);

void SetZipCode(int zip);


// Copies some properties into out arguments

void GetFirstName(char buff[], int sz) const;

void GetLastName(char buff[], int sz) const;


void AddEntryFromConsole();

void PrintToConsole();

void AppendToFile();


AddressBook& AddressBook::operator=(const AddressBook& obj);

};


bool operator== (const AddressBook& obj1, const AddressBook& obj2);


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.h
******************
#include <string>

using namespace std;

const int ENTRY_SZ = 256;

class AddressBook
{
private:
char firstName_[ENTRY_SZ];
char lastName_[ENTRY_SZ];
int streetNum_;
char streetName_[ENTRY_SZ];
char city_[ENTRY_SZ];
char state_[ENTRY_SZ];
int zipCode_;

public:

static int entryCnt;
static char filePath[ENTRY_SZ];

void SetFirstName(const char fName[]);
void SetLastName(const char buff[]);
void SetStreetNum(const char buff[]);
void SetStreetNum(int num);
void SetStreetName(const char buff[]);
void SetCity(const char buff[]);
void SetState(const char buff[]);
void SetZipCode(const char buff[]);
void SetZipCode(int zip);

// Copies some properties into out arguments
void GetFirstName(char buff[], int sz) const;
void GetLastName(char buff[], int sz) const;

void AddEntryFromConsole();
void PrintToConsole();
void AppendToFile();

AddressBook& AddressBook::operator=(const AddressBook& obj);
};

bool operator== (const AddressBook& obj1, const AddressBook& obj2);

AddressBook.cpp
********************
#include <iostream>
#include "AddressBook.h"

AddressBook::AddressBook()
{
}

AddressBook::~AddressBook()
{
}

void AddressBook::SetFirstName(string name)
{
first_ = name;
}

string AddressBook::GetFirstName()
{
return first_;
}

void AddressBook::SetLastName(string name)
{
last_ = name;
}

string AddressBook::GetLastName()
{
return last_;
}

void AddressBook::SetId(long id)
{
id_ = id;
}

long AddressBook::GetId()
{
return id_;;
}

void AddressBook::Populate()
{
cout << "\nEnter first name: ";
cin >> first_;

cout << "\nEnter last name: ";
cin >> last_;

cout << "\nEnter id: ";
cin >> id_;
}

main.cpp
**********
#include <iostream>
#include "AddressBook.h"

using namespace std;

void FillArray(AddressBook clients[], int sz);
int GetMaxIdx(AddressBook clients[], int sz);

void main()
{
const int ARR_SZ = 30;
AddressBook clients[ARR_SZ];

FillArray(clients, ARR_SZ);

int x;
cin >> x;
}

void FillArray(AddressBook clients[], int sz)
{
for (int i = 0; i < sz; ++i)
{
clients[i].Populate();
}
}

int GetMaxIdx(AddressBook clients[], int sz)
{
int maxidx = 0;

for (int i = 0; i < sz; ++i)
{
if (clients[i].GetLastName() < clients[maxidx].GetLastName())
{
maxidx = i;
}
}

return maxidx;
}

The code is modeling essentially everything I need, I'm just trying to find any major/minor mistakes because it won't compile...

In general, I've also been having trouble refering to headers, like #include "AddressBook.h". ANY help would be greatly appreciated
Topic archived. No new replies allowed.