From 227d0ef1a88219d54f2154c5fa95cae51ba932a6 Mon Sep 17 00:00:00 2001 From: Connor McDowell Date: Wed, 21 Feb 2024 14:02:30 -0800 Subject: share push --- Project1/Contacts.h | 2 +- Project1/contacts.cpp | 4 +--- Project1/program.cpp | 6 +++--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Project1/Contacts.h b/Project1/Contacts.h index b59fbc5..a1ef0fb 100644 --- a/Project1/Contacts.h +++ b/Project1/Contacts.h @@ -9,7 +9,7 @@ struct contact { bool a = true; size_t id = 0; - int count = 0; + size_t count = 0; char Name[25]{}; char Email[100]{}; char StreetAddress[35]{}; diff --git a/Project1/contacts.cpp b/Project1/contacts.cpp index 79f048c..828bef5 100644 --- a/Project1/contacts.cpp +++ b/Project1/contacts.cpp @@ -7,8 +7,6 @@ using std::cin; using std::cout; using std::endl; - - char addNew(contact newContact[], size_t MAX, size_t t) { //using couts to prompt using for all parts of newContact struct. @@ -114,7 +112,7 @@ void printAll(contact newContact[], size_t MAX) void contact_double(contact*& newContact, size_t& MAX, size_t t) { - //supposedly doubles length. doesnt work. + //supposedly doubles length. doesn't work. //current ideas: add if loop to whole main with the id counter t and if length of newContact = max double the length. //current problems: using const size_t max prevents editing size for the whole function, and it resets as soon as the while loop loops or leaves the scope of the if statement. contact* doubleContact = new contact[MAX * 2]; diff --git a/Project1/program.cpp b/Project1/program.cpp index 24a02ff..8b542f1 100644 --- a/Project1/program.cpp +++ b/Project1/program.cpp @@ -14,12 +14,12 @@ using std::endl; int main() { + size_t MAX = 3; int O = 1; + size_t t = 0; + contact* newContact = new contact[MAX]; while (O == 1) { - size_t MAX = 3; - size_t t = 0; - contact* newContact = new contact[MAX]; int c = 0; cout << "1. Enter a contact\n"; cout << "2. Update a contact\n"; -- cgit v1.2.3