From 0557774b1e8e0124768aa03f24bda5c76dfc8c44 Mon Sep 17 00:00:00 2001 From: Connor McDowell Date: Wed, 21 Feb 2024 19:23:11 -0800 Subject: testing --- Project1/contacts.cpp | 68 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 66 insertions(+), 2 deletions(-) (limited to 'Project1/contacts.cpp') diff --git a/Project1/contacts.cpp b/Project1/contacts.cpp index 67bed22..95df50f 100644 --- a/Project1/contacts.cpp +++ b/Project1/contacts.cpp @@ -18,6 +18,30 @@ char addNew(contact newContact[], size_t MAX, size_t& t) // void mod_update // to check for any "empty"/deleted contacts before adding one. if bool == false should include break after mod_update. //CURRENTLY WORKS + for (size_t i = 0; i < MAX, i++;) + { + for(newContact[i].a = 1; ++i;) + { + newContact[i].id = i; + newContact[i].count = t; + cin.ignore(1000, '\n'); + cout << "Please enter each piece of information when you are prompted to" << endl; + cout << "enter name: " << endl; + cin.getline(newContact[i].Name, 25); + cout << "enter Email: " << endl; + cin.getline(newContact[i].Email, 100); + cout << "enter Street Address: " << endl; + cin.getline(newContact[i].StreetAddress, 35); + cout << "enter city: " << endl; + cin.getline(newContact[i].City, 30); + cout << "enter State as two letter abbreviation: " << endl; + cin.getline(newContact[i].State, 3); + cout << "Please enter the next value as a series of numbers" << endl; + cout << "enter Zip: " << endl; + cin >> newContact[i].Zip; + break; + } + } for (size_t i = t ; i < MAX; i++) { newContact[i].id = i+1; @@ -100,6 +124,14 @@ void printAll(contact newContact[], size_t& MAX) if (newContact[i].id > MAX) { break; } + if(newContact[i].a == 0) + { + continue; + } + //if (newContact[i].a == 1) + //{ + // break; + //} cout << "List number: " << newContact[i].id << endl; cout << "name: " << newContact[i].Name << endl; @@ -162,9 +194,41 @@ size_t max_double(size_t MAX) return MAX; } -void delete_contact(contact newContact[]) +void delete_contact(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 - //add to new part to addNew: if bool != 0 then copy and paste update code w/addNew couts + //add to new part to addNew: if bool != 0 then copy and paste update code w/addNew couts + cout << "The list of contacts and their names will now print" << endl; + for (auto i = 0u; i <= MAX; i++) + { + if (newContact[i].id == 0) { + break; + } + if (newContact[i].id < 0) { + break; + } + if (newContact[i].id > MAX) { + break; + } + //if (newContact[i].a == 1) + //{ + // break; + //} + cout << "Id number: " << newContact[i].id << " is under the name: " << newContact[i].Name << endl; + } + size_t delete_choice = 0; + cout << "\n"; + cin.ignore(1000, '\n'); + cout << "Enter the id number of the contact you'd like to delete" << endl; + cin >> delete_choice; + for (auto i = 0u; i < MAX;) + { + if (delete_choice == newContact[i].id) + { + newContact[i].a = 1; + cout << "Contact number: " << newContact[i].id << " deleted" << endl; + break; + } + } } \ No newline at end of file -- cgit v1.2.3