From 940701c948ba488c0d2ae7e7214763001d4b5684 Mon Sep 17 00:00:00 2001 From: Connor McDowell Date: Mon, 19 Feb 2024 20:42:12 -0800 Subject: i hate this. with this combined with assignment 5 ive spent almost 30 hours over two days plus the last 4 hours on this. --- Project1/program.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'Project1/program.cpp') diff --git a/Project1/program.cpp b/Project1/program.cpp index 7f01a8f..639a7ac 100644 --- a/Project1/program.cpp +++ b/Project1/program.cpp @@ -14,10 +14,10 @@ using std::endl; int main() { - constexpr size_t MAX = 10; + size_t MAX = 3; int O = 1; - int t = 0; - contact newContact[MAX]; + size_t t = 0; + contact* newContact = new contact[MAX]; while (O == 1) { int c = 0; @@ -32,7 +32,6 @@ int main() if (c == 1) { addNew(&newContact[MAX], MAX, t); - ++t; //cout << t << endl; } if (c == 2) @@ -46,6 +45,14 @@ int main() if (c == 5) { O = 0; + delete[] newContact; + } + ++t; + if (t >= MAX - 1) + { + *newContact = contact_double(&newContact[MAX], MAX, t); + MAX = MAX * 2; } } + return 0; } \ No newline at end of file -- cgit v1.2.3