diff options
| author | Connor McDowell <[email protected]> | 2024-02-29 17:45:43 -0800 |
|---|---|---|
| committer | Connor McDowell <[email protected]> | 2024-02-29 17:45:43 -0800 |
| commit | af779b3da6389e54c3894d5de1d940e35c65c1c7 (patch) | |
| tree | dfa93c61a1bb0329b06ba6ca30da76f694f2cc74 | |
| parent | setting all functions to run in contact_list class (diff) | |
| download | homework-7-connormcdowell275-af779b3da6389e54c3894d5de1d940e35c65c1c7.tar.xz homework-7-connormcdowell275-af779b3da6389e54c3894d5de1d940e35c65c1c7.zip | |
all functions refactored to fit in contact list. testing now.
still testing. spent several hours on this total today, will continue tomorrow.
| -rw-r--r-- | Project1/Contacts.h | 10 | ||||
| -rw-r--r-- | Project1/contacts.cpp | 4 | ||||
| -rw-r--r-- | Project1/program.cpp | 4 |
3 files changed, 9 insertions, 9 deletions
diff --git a/Project1/Contacts.h b/Project1/Contacts.h index a86f698..a314f0f 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 newContact[], size_t MAX); + void DeleteContact(contact& contact); void CopyList(const contact* contacts, const size_t& size); - void AddContact(contact* newContact, size_t MAX, size_t& t); + void AddContact(const contact& contact, size_t MAX, size_t& t); - void update(contact newContact[], size_t MAX); + void update(const contact& contact, size_t MAX); - void Print(contact newContact[], size_t& MAX); + void Print(contact newContact[], size_t& MAX) const; - //size_t Size() const; + size_t Size() const; }; //struct contact_struct diff --git a/Project1/contacts.cpp b/Project1/contacts.cpp index e7c537f..caca7df 100644 --- a/Project1/contacts.cpp +++ b/Project1/contacts.cpp @@ -235,7 +235,7 @@ void contact_list::AddContact(contact* newContact, size_t MAX, size_t& t) // //} -void contact_list::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 contact_list::update(contact newContact[], size_t MAX) } } -void contact_list::Print(contact newContact[], size_t& MAX) +void contact_list::Print(contact newContact[], size_t& MAX) const { //prints all info but count and bool for every existing (non trash value filled) contact struct //CURRENTLY WORKING diff --git a/Project1/program.cpp b/Project1/program.cpp index 938b7ef..a8971b4 100644 --- a/Project1/program.cpp +++ b/Project1/program.cpp @@ -38,7 +38,7 @@ int main() { case 1: //addNew(newContact, MAX, t); - contact_list.AddContact(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 @@ -50,7 +50,7 @@ int main() } break; case 2: - contact_list.update(newContact, MAX); + contact_list.update(*newContact, MAX); break; case 3: contact_list.Print(newContact, MAX); // Print only the existing contacts |