diff options
| author | Connor McDowell <[email protected]> | 2024-02-17 20:21:37 -0800 |
|---|---|---|
| committer | Connor McDowell <[email protected]> | 2024-02-17 20:21:37 -0800 |
| commit | 12ac77df4d844cb760db95ec65b9ed99d6bfeb7f (patch) | |
| tree | 11c9d88d5bb54f31b7cb6dd6cad71fb82acd39c0 | |
| parent | finally getting into the groove of this assignment (diff) | |
| download | homework-5-connormcdowell275-12ac77df4d844cb760db95ec65b9ed99d6bfeb7f.tar.xz homework-5-connormcdowell275-12ac77df4d844cb760db95ec65b9ed99d6bfeb7f.zip | |
honk shoo
| -rw-r--r-- | Project1/Contacts.h | 3 | ||||
| -rw-r--r-- | Project1/contacts.cpp | 60 | ||||
| -rw-r--r-- | Project1/program.cpp | 43 |
3 files changed, 38 insertions, 68 deletions
diff --git a/Project1/Contacts.h b/Project1/Contacts.h index a6b9497..00388dc 100644 --- a/Project1/Contacts.h +++ b/Project1/Contacts.h @@ -7,6 +7,7 @@ struct contact { + int id = 0; char Name[25] = {}; char Email[100] = {}; char StreetAddress[35] = {}; @@ -18,7 +19,7 @@ struct contact int menu(); -char addNew(contact newContact); +char addNew(contact newContact[]); void update(); diff --git a/Project1/contacts.cpp b/Project1/contacts.cpp index f932281..d738b31 100644 --- a/Project1/contacts.cpp +++ b/Project1/contacts.cpp @@ -24,7 +24,7 @@ int menu() return c; } -char addNew(contact newContact) +char addNew(contact* newContact[]) { int i = 0; @@ -35,17 +35,35 @@ char addNew(contact newContact) cout << "works!" << endl; for (int i = 0; i < 10; i++) { - cin >> newContact[i].Name; - cin >> newContact[i].Email; - cin >> newContact[i].StreetAddress; - cin >> newContact[i].City; - cin >> newContact[i].State; - cin >> newContact[i].Zip; + newContact[i]->id = i + 1; + cin >> newContact[i]->Name; + cin >> newContact[i]->Email; + cin >> newContact[i]->StreetAddress; + cin >> newContact[i]->City; + cin >> newContact[i]->State; + cin >> newContact[i]->Zip; break; } - cout << newContact[i].Name << "\n" << newContact[i].Email << "\n" << newContact[i].StreetAddress << "\n" << newContact[i].City << "\n" << newContact[i].State << "\n" << newContact[i].Zip << endl; + cout << newContact[i]->Name << "\n" << newContact[i]->Email << "\n" << newContact[i]->StreetAddress << "\n" << newContact[i]->City << "\n" << newContact[i]->State << "\n" << newContact[i]->Zip << endl; } } +// print contact i +// name: +// email +// address +// city +// state +// zip + +void update(contact newContact[]) +{ + int i = 0; + cin >> i; + i - 1; + newContact[i].id; + + +} //struct contact_list @@ -60,32 +78,6 @@ char addNew(contact newContact) // //} -//char addNew() -//{ -// contact newContact; -// cin >> newContact.Name; -// cout << newContact.Name << endl; -// cin >> newContact.Email; -// cout << newContact.Email << endl; -// cin >> newContact.StreetAddress; -// cout << newContact.StreetAddress << endl; -// cin >> newContact.City; -// cout << newContact.City << endl; -// cin >> newContact.State; -// cout << newContact.State << endl; -// cin >> newContact.Zip; -// cout << newContact.Zip << endl; -// -// -// -// return 0; -//} - -//for (auto const& i : name) -//{ -// cout << i << endl; -//} - // add: prompt add, get cin for contact.name contact.email contact.address contact.city and contact.zip // add update: find struct through name value (if contact.name == i = cin pull up that struct and do similar // to add) and save over it diff --git a/Project1/program.cpp b/Project1/program.cpp index e5cd30a..88ad645 100644 --- a/Project1/program.cpp +++ b/Project1/program.cpp @@ -25,38 +25,15 @@ using std::endl; int main() { + int O = 1; contact newContact[10]; - //int choice = menu(); - //int i = 0; - //int c = 0; - //cin >> c; - //if (c == 1) - //{ - // cout << "works!" << endl; - // for (int i = 0; i < 10; i++) - // { - // cin >> newContact[i].Name; - // cin >> newContact[i].Email; - // cin >> newContact[i].StreetAddress; - // cin >> newContact[i].City; - // cin >> newContact[i].State; - // cin >> newContact[i].Zip; - // break; - // } - // cout << newContact[i].Name << "\n" << newContact[i].Email << "\n" << newContact[i].StreetAddress << "\n" << newContact[i].City << "\n" << newContact[i].State << "\n" << newContact[i].Zip << endl; - //} - //for (int i = 0; i < 10; i++) - //{ - // cin >> newContact[i].Name; - // cin >> newContact[i].Email; - // cin >> newContact[i].StreetAddress; - // cin >> newContact[i].City; - // cin >> newContact[i].State; - // cin >> newContact[i].Zip; - //} - /*cin >> i; - cout << newContact[i].Name << "\n" << newContact[i].Email << "\n" << newContact[i].StreetAddress << "\n" << newContact[i].City << "\n" << newContact[i].State << "\n" << newContact[i].Zip << endl;*/ - /*cout << "new name"; - cin >> newContact[2].Name; - cout << newContact[2].Name;*/ + while (O == 1) + { + int c = 0; + c = menu(); + if (c = 1) + { + addNew(&newContact[10]); + } + } }
\ No newline at end of file |