diff options
Diffstat (limited to 'Project1/program.cpp')
| -rw-r--r-- | Project1/program.cpp | 15 |
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 |