Question
Complete Source Code if needed: https://repl.it/@BackUp/Assignment-1-Q1 #include addressBookType.hpp void addressBookType::swap(int m, int n) { string str1, str2, str3, str4; person[m].getPerson(str1, str2); person[n].getPerson(str3, str4); person[m].setPerson(str3, str4);
Complete Source Code if needed: https://repl.it/@BackUp/Assignment-1-Q1
#include "addressBookType.hpp"
void addressBookType::swap(int m, int n) { string str1, str2, str3, str4; person[m].getPerson(str1, str2); person[n].getPerson(str3, str4); person[m].setPerson(str3, str4); person[n].setPerson(str1, str2); dateType bd1, bd2; person[m].getBirthDate(bd1); person[n].getBirthDate(bd2); person[m].setBirthDate(bd2); person[n].setBirthDate(bd1); addressType add1,add2; person[m].getAddress(add1); person[n].getAddress(add2); person[m].setAddress(add2); person[n].setAddress(add1); str1=person[m].getAssociation(); str2=person[n].getAssociation(); person[m].setAssociation(str2); person[n].setAssociation(str1); str1=person[m].getPhone(); str2=person[n].getPhone(); person[m].setPhone(str2); person[n].setPhone(str1); }
addressBookType::addressBookType() { ifstream inFile; string fileName = " "; cout>fileName; inFile.open(fileName.c_str()); if (!inFile.is_open()) { cout>strs[0]>>strs[1]>>nums[0]>>nums[1]>>nums[2]>>strs[2]>>strs[3]>>strs[4]>>nums[3]>>strs[5]>>strs[6])) { person [ind].setExtPerson(strs[0], strs[1], nums[0], nums[1], nums[2], strs[2], strs[3], strs[4], nums[3], strs [5], strs[6]); ind++; } } void addressBookType::sortByLastName() { int i, j, smallestInd; string str1, str2, temp; for (i=0; i >keyName; for(int i=0; i { person[i].getPerson(temp,name); if (keyName.compare(name)==0) return i; } return -1; } void addressBookType::printAPerson() const { int result = searchBYName(); if (result == -1) cout>month; for(int i=0; i { person[i].getBirthDate(bd); if(bd.getMonth()==month) { cout
void addressBookType::printAssociation() const { string asso; string types[3]={"Familymember", "Familyfriend", "BusinessAssociate"}; int choice, count=0; cout>choice; for (int i=0; i { asso=person[i].getAssociation(); if(asso.compare(types[choice-1])==0) { cout
.hpp
#ifndef addressBookType_hpp #define addressBookType_hpp
#include
using namespace std;
const int MAX_ENTRIES = 500; class addressBookType { public: addressBookType(); void sortByLastName(); int searchBYName() const; void printAPerson () const; void printAddressBook () const; void printByBirthday() const; void printNamesBetween() const; void printAssociation() const; private: extPersonType person [MAX_ENTRIES]; int ind; void swap (int, int); };
#endif /* addressBookType_hpp */
This is problem #5 in Chapter 11 which was assigned in Assignment #1 but this time you will use a Linked list to handle as many entities as needed instead of the 500 fixed number used in Chapter 11
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