Question
I need help creating header files for this program. #include ClientList.h ClientList::ClientList() { length = 0; listData = NULL; } ClientList:: ~ClientList() { ClientNode* tempPtr;
I need help creating header files for this program.
#include "ClientList.h" ClientList::ClientList() { length = 0; listData = NULL; } ClientList:: ~ClientList() { ClientNode* tempPtr; while (listData != NULL) { tempPtr = listData; listData = listData->next; delete tempPtr; } } void ClientList::makeEmpty() { ClientNode* tempPtr; while (listData != NULL) { tempPtr = listData; listData = listData->next; delete tempPtr; } length = 0; } bool ClientList::isFull() { ClientNode* location; try { location = new ClientNode; delete location; return false; } catch (std::bad_alloc exception) { return true; } } int ClientList::getLength() { return length; } Client ClientList::getClient(Client person) { bool moreToSearch; ClientNode* location; location = listData; bool found = false; moreToSearch = (location != NULL); while (moreToSearch && !found) { switch (person.compareTo(location->info)) { case LESS: case GREATER: location = location->next; moreToSearch = (location != NULL); break; case EQUAL: found = true; person = location->info; break; } } return person; } void ClientList::newClient(Client person) { ClientNode* location; ClientNode* newNode; newNode = new ClientNode; newNode->info = person; newNode->next = NULL; if (!listData) listData = newNode; else { location = listData; while (location->next) location = location->next; location->next = newNode; } length++; } void ClientList::deleteClient(Client person) { ClientNode* location = listData; ClientNode* tempLocation; if (person.compareTo(location->info) == EQUAL) { tempLocation = location; listData = listData->next; } else { while (person.compareTo((location->next)->info) != EQUAL) location = location->next; tempLocation = location->next; location->next = (location->next)->next; delete tempLocation; length--; } } void ClientList::resetList() { currentPos = NULL; } Client ClientList::getNextItem() { if (currentPos = NULL) currentPos = listData; else currentPos = currentPos->next; return currentPos->info; } void ClientList::printFreeClients() { ClientNode* location = listData; while (location != NULL) { if (location->info.getMatch() == " ") { location->info.getClientDescription(); cout << endl; } } } void ClientList::printMatches(ClientList& otherList) { ClientNode* location = listData; ClientNode* otherLocation = otherList.listData; while (location != NULL && otherLocation != NULL) { if (location->info.getMatch() != " ") { location->info.getClientDescription(); cout << endl; } if (otherLocation->info.getMatch() != " ") { otherLocation->info.getClientDescription(); cout << endl; } } } Client ClientList::getMatchingClient(Client& otherClient) { ClientNode* location = listData; while (location != NULL) { if (location->info.isMatchingClient(otherClient)) { otherClient = location->info; return otherClient; } location = location->next; } } #include "Client.h" Client::Client() { numInterest = 0; } void Client::setGender(char gender) { sex = gender; } void Client::setName(string n) { name = n; } void Client::setPhone(string p) { phoneNum = p; } void Client::setInterest(string i) { for (int index = 0; index < 10; index++) interest[index] = i; } bool Client::isMatchingClient(Client& otherClient) { int index = 0, length = 10; bool found = false; while (index < length && !found) { if (interest[index] == otherClient.interest[index]) { found = true; match = otherClient.getName(); numInterest++; otherClient.match = name; otherClient.numInterest++; } index++; } return found; } void Client::setMatch(string& m) { match = m; } relationType Client::compareTo(Client otherClient) { if (name < otherClient.name) return LESS; else if (name > otherClient.name) return GREATER; else return EQUAL; } char Client::getGender() const { return sex; } string Client::getName() const { return name; } string Client::getPhone() const { return phoneNum; } string Client::getClientDescription() const { string desc; desc = name + " " + sex + " " + phoneNum; return desc; } int Client::getNumInterest() const { return numInterest; } string Client::getMatch() const { return match; } # include "Client.h" # include "ClientList.h" # include # include # include # include # include using namespace std; void displayMenu(); int main() { string choice; ClientList femaleList, maleList; Client member; do { cout << " Enter one of the options from the menu. "; displayMenu(); cin >> choice; cin.ignore(); if (choice == "NEWCLIENT" || choice == "newclient") { char clientSex, repeat; string clientName, clientPhone, clientInterest; int numInterest; bool found; do { cout << "Enter the following information for each client: "; cout << "Enter the gender of the client (\'M\' for male "; cout << "or \'F\' for female) "; cin.get(clientSex); cin.ignore(); while (toupper(clientSex) != 'M' && toupper(clientSex) != 'F') { cout << "Invalid entry. Enter \'m\' or \'f\'."; cin.get(clientSex); cin.ignore(); } if (toupper(clientSex) == 'M') member.setGender(clientSex); else if (toupper(clientSex) == 'F') member.setGender(clientSex); cout << "Enter the name of the client (use only 21 letters) "; getline(cin, clientName); member.setName(clientName); cout << "Enter the phone number of the client (use only 7 digits) "; getline(cin, clientPhone); member.setPhone(clientPhone); cout << "Enter the number of interests for the client "; cout << "(maximum of 10 interests per person) "; cin >> numInterest; cin.ignore(); for (int index = 0; index < numInterest; index++) { cout << "Enter interest " << (index + 1); cout << ": (add a comma after each interest) "; getline(cin, clientInterest); member.setInterest(clientInterest); } if (member.getGender() == 'M' || member.getGender() == 'm') { maleList.newClient(member); } else if (member.getGender() == 'F' || member.getGender() == 'f') femaleList.newClient(member); cout << "Would you like to enter another client? (y/n)? "; cin.get(repeat); cin.ignore(); } while (toupper(repeat) != 'N'); } else if (choice == "UNMATCH" || choice == "unmatch") { string empty = " "; member.setMatch(empty); } else if (choice == "PRINTMATCH" || choice == "printmatch") { maleList.printMatches(femaleList); femaleList.printMatches(maleList); } else if (choice == "PRINTFREE" || choice == "printfree") { femaleList.printFreeClients(); maleList.printFreeClients(); } else if (choice == "QUIT" || choice == "quit") { return 0; } else cout << "Invalid entry. Please try again. "; } while (choice != "QUIT" || choice != "quit"); cin.get(); return 0; } void displayMenu() { cout << "NEWCLIENT:\tAdd a new member to the database "; cout << "UNMATCH:\tRemoves the matching member from the client "; cout << "PRINTMATCH:\tPrints a list of all matched members "; cout << "PRINTFREE:\tPrints the name and phone numbers of members that " << "currenctly \t\tare not matched "; \ cout << "QUIT:\t\tEnds program "; } I receive Errors Error C1014 too many include files: depth = 1024 Win32Project1 client.h Error (active) E0003 #include file "C:\USERS\BLEK'S\DOCUMENTS\VISUAL STUDIO 2017 Client.h 1
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started