aboutsummaryrefslogtreecommitdiff
path: root/Project1/program.cpp
diff options
context:
space:
mode:
authorConnor McDowell <[email protected]>2024-02-19 20:42:12 -0800
committerConnor McDowell <[email protected]>2024-02-19 20:42:12 -0800
commit940701c948ba488c0d2ae7e7214763001d4b5684 (patch)
tree4a58c655da6989bbbdd3c2f94346d80487f6eb16 /Project1/program.cpp
parentstarted fuckin over. (diff)
downloadhomework-6-connormcdowell275-940701c948ba488c0d2ae7e7214763001d4b5684.tar.xz
homework-6-connormcdowell275-940701c948ba488c0d2ae7e7214763001d4b5684.zip
i hate this. with this combined with assignment 5 ive spent almost 30 hours over two days plus the last 4 hours on this.
Diffstat (limited to 'Project1/program.cpp')
-rw-r--r--Project1/program.cpp15
1 files changed, 11 insertions, 4 deletions
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