diff options
| author | Connor McDowell <[email protected]> | 2024-02-21 16:17:47 -0800 |
|---|---|---|
| committer | Connor McDowell <[email protected]> | 2024-02-21 16:17:47 -0800 |
| commit | a10ee9a9bc8e1a086e112a1e381b63d4a4c96112 (patch) | |
| tree | 2cff8a565810dd99348c2447c884b6dde7a20393 /Project1/contacts.cpp | |
| parent | still testing (diff) | |
| download | archived-homework-6-connormcdowell275-a10ee9a9bc8e1a086e112a1e381b63d4a4c96112.tar.xz archived-homework-6-connormcdowell275-a10ee9a9bc8e1a086e112a1e381b63d4a4c96112.zip | |
pushing
Diffstat (limited to 'Project1/contacts.cpp')
| -rw-r--r-- | Project1/contacts.cpp | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/Project1/contacts.cpp b/Project1/contacts.cpp index 162d30b..a35c74f 100644 --- a/Project1/contacts.cpp +++ b/Project1/contacts.cpp @@ -7,7 +7,7 @@ using std::cin; using std::cout; using std::endl; -char addNew(contact newContact[], size_t MAX, size_t t) +char addNew(contact newContact[], size_t MAX, size_t& t) { //using couts to prompt using for all parts of newContact struct. //update plans: check for newContact[i].bool value, if false, use a modified void update @@ -37,6 +37,7 @@ char addNew(contact newContact[], size_t MAX, size_t t) cout << "Please enter the next value as a series of numbers" << endl; cout << "enter Zip: " << endl; cin >> newContact[i].Zip; + t++; break; } @@ -81,11 +82,11 @@ void update(contact newContact[], size_t MAX) } } -void printAll(contact newContact[], size_t MAX) +void printAll(contact newContact[], size_t& MAX) { //prints all info but count and bool for every existing (non trash value filled) contact struct //CURRENTLY WORKING - for (int i = 0; i < MAX; ++i) + for (size_t i = 0; i <= MAX; ++i) { /*for (int t = -1; t < newContact[i].id;) { break; @@ -118,12 +119,29 @@ contact contact_double(contact*& newContact, size_t& MAX, size_t t) contact* doubleContact = new contact[MAX * 2]; for (auto a = 0u; a < MAX; ++a) { - doubleContact[a] = newContact[a]; + doubleContact[a].a = newContact[a].a; + doubleContact[a].id = newContact[a].id; + doubleContact[a].count = newContact[a].count; + doubleContact[a].Name[25] = newContact[a].Name[25]; + doubleContact[a].Email[100] = newContact[a].Email[100]; + doubleContact[a].StreetAddress[35] = newContact[a].StreetAddress[35]; + doubleContact[a].City[30] = newContact[a].City[30]; + doubleContact[a].State[3] = newContact[a].State[3]; + doubleContact[a].Zip = newContact[a].Zip; + cout << "List number: " << doubleContact[a].id << endl; + cout << "name: " << doubleContact[a].Name << endl; + cout << "Email: " << doubleContact[a].Email << endl; + cout << "Address: " << doubleContact[a].StreetAddress << endl; + cout << "city: " << doubleContact[a].City << endl; + cout << "state: " << doubleContact[a].State << endl; + cout << "Zip: " << doubleContact[a].Zip << endl; } newContact = doubleContact; delete[] doubleContact; + //delete[] newContact; MAX = MAX * 2; - printAll(&newContact[MAX], MAX); + //printAll(&doubleContact[MAX], MAX); + //printAll(&newContact[MAX], MAX); return newContact[MAX]; } |