// name: Connor McDowell // date: 2/19/2024 // class: CST116 // reason: homework number 6 #include "Contact_list.h" #include using std::cin; using std::cout; using std::endl; //constexpr size_t MAX = 3; int main() { size_t MAX = 3; int O = 1; /* t = index counter*/ contact newContact; //contact* newContact = new contact[MAX]; contact_list contacts(MAX); size_t t = 0; contacts.set_size(sizeof(newContact)); while (O == 1) { //cout << MAX << endl; // c = choice input int c = 0; cout << "1. Enter a contact\n"; cout << "2. Update a contact\n"; cout << "3. print all contacts\n"; cout << "4. Delete a contact\n"; cout << "5. Quit\n"; cout << "\nEnter your choice: " << endl; cin >> c; switch (c) { case 1: //addNew(newContact, MAX, t); contacts.AddContact(newContact); //if (t >= MAX) // Check if the number of contacts exceeds MAX //{ // contact* newContactTemp = new contact[MAX * 2]; // Double the size // for (size_t i = 0; i < MAX; ++i) // Copy existing contacts // newContactTemp[i] = newContact[i]; // delete[] newContact; // Deallocate old memory // newContact = newContactTemp; // Update pointer // MAX *= 2; // Update MAX //} break; case 2: //contacts.Update(newContact); cout << "this program is currently a work in progress" << endl; break; case 3: contacts.Print(); // Print only the existing contacts break; case 4: contacts.DeleteContact(newContact); //contacts.CopyList(&newContact, MAX); break; case 5: O = 0; break; default: cout << "Invalid choice. Please enter a number from 1 to 5." << endl; } } return 0; }