diff options
| author | Connor McDowell <[email protected]> | 2024-02-29 17:25:46 -0800 |
|---|---|---|
| committer | Connor McDowell <[email protected]> | 2024-02-29 17:25:46 -0800 |
| commit | c8a41214a06485ce310528b595782fb70dd88ee7 (patch) | |
| tree | f12e006ee76cc0a30b4fe5874965ab909ac71311 | |
| parent | code built properly. comensing testing phase. (diff) | |
| download | homework-7-connormcdowell275-c8a41214a06485ce310528b595782fb70dd88ee7.tar.xz homework-7-connormcdowell275-c8a41214a06485ce310528b595782fb70dd88ee7.zip | |
setting all functions to run in contact_list class
| -rw-r--r-- | Project1/Contacts.h | 36 | ||||
| -rw-r--r-- | Project1/contacts.cpp | 10 | ||||
| -rw-r--r-- | Project1/program.cpp | 9 |
3 files changed, 28 insertions, 27 deletions
diff --git a/Project1/Contacts.h b/Project1/Contacts.h index 3020e27..a86f698 100644 --- a/Project1/Contacts.h +++ b/Project1/Contacts.h @@ -80,17 +80,17 @@ public: void set_size(size_t size); size_t get_size(); - void DeleteContact(contact& contact); + void DeleteContact(contact newContact[], size_t MAX); void CopyList(const contact* contacts, const size_t& size); - void AddContact(const contact& contact); + void AddContact(contact* newContact, size_t MAX, size_t& t); - void update(const contact& contact); + void update(contact newContact[], size_t MAX); - void Print() const; + void Print(contact newContact[], size_t& MAX); - size_t Size() const; + //size_t Size() const; }; //struct contact_struct @@ -121,18 +121,18 @@ public: //}; //contact newContact[11]; -int menu(); - -char addNew(contact newContact[], size_t MAX, size_t& t); - -void update(contact newContact[], size_t MAX); - -void printAll(contact newContact[], size_t& MAX); - -contact contact_double(contact*& newContact, size_t& MAX, size_t t); - -size_t max_double(size_t MAX); - -void delete_contact(contact newContact[], size_t MAX); +//int menu(); +// +//char addNew(contact newContact[], size_t MAX, size_t& t); +// +//void update(contact newContact[], size_t MAX); +// +//void printAll(contact newContact[], size_t& MAX); +// +//contact contact_double(contact*& newContact, size_t& MAX, size_t t); +// +//size_t max_double(size_t MAX); +// +//void delete_contact(contact newContact[], size_t MAX); #endif CONTACTS_HEADER_H
\ No newline at end of file diff --git a/Project1/contacts.cpp b/Project1/contacts.cpp index 917d085..e7c537f 100644 --- a/Project1/contacts.cpp +++ b/Project1/contacts.cpp @@ -118,7 +118,7 @@ size_t contact::Get_id() } //functions -char addNew(contact newContact[], size_t MAX, size_t& t) +void contact_list::AddContact(contact* newContact, size_t MAX, size_t& t) { //using couts to prompt using for all parts of newContact struct. //update plans: check for newContact[i].bool value, if false, use a modified void update @@ -220,7 +220,7 @@ char addNew(contact newContact[], size_t MAX, size_t& t) } //cout << newContact[i]->Name << "\n" << newContact[i]->Email << "\n" << newContact[i]->StreetAddress << "\n" << newContact[i]->City << "\n" << newContact[i]->State << "\n" << newContact[i]->Zip << endl; - return 0; + } // important below. may need if current testing doesnt work. @@ -235,7 +235,7 @@ char addNew(contact newContact[], size_t MAX, size_t& t) // //} -void update(contact newContact[], size_t MAX) +void contact_list::update(contact newContact[], size_t MAX) { //uses input based on list number from print (though when delete is made will be using that id/name print) to update the values of. //CURRENTLY TESTING @@ -281,7 +281,7 @@ void update(contact newContact[], size_t MAX) } } -void printAll(contact newContact[], size_t& MAX) +void contact_list::Print(contact newContact[], size_t& MAX) { //prints all info but count and bool for every existing (non trash value filled) contact struct //CURRENTLY WORKING @@ -369,7 +369,7 @@ size_t max_double(size_t MAX) return MAX; } -void delete_contact(contact newContact[], size_t MAX) +void contact_list::DeleteContact(contact newContact[], size_t MAX) { //Work in progress, add BOOL (true) to struct, when this is selected print id list with respective names //then take input of id list number and set bool to false diff --git a/Project1/program.cpp b/Project1/program.cpp index 129284f..938b7ef 100644 --- a/Project1/program.cpp +++ b/Project1/program.cpp @@ -37,7 +37,8 @@ int main() switch (c) { case 1: - addNew(newContact, MAX, t); + //addNew(newContact, MAX, t); + contact_list.AddContact(newContact, MAX, t); if (t >= MAX) // Check if the number of contacts exceeds MAX { contact* newContactTemp = new contact[MAX * 2]; // Double the size @@ -49,13 +50,13 @@ int main() } break; case 2: - update(newContact, MAX); + contact_list.update(newContact, MAX); break; case 3: - printAll(newContact, MAX); // Print only the existing contacts + contact_list.Print(newContact, MAX); // Print only the existing contacts break; case 4: - delete_contact(newContact, MAX); + contact_list.DeleteContact(newContact, MAX); break; case 5: O = 0; |