diff options
| author | Asahel <[email protected]> | 2024-03-01 09:28:56 -0800 |
|---|---|---|
| committer | Asahel <[email protected]> | 2024-03-01 09:28:56 -0800 |
| commit | 3b114c34920b3eb4b56143d432f8bee3ec9b89e6 (patch) | |
| tree | 1e3fbb608cca2962d3152fcc0a4613516dacbf11 /Homework6/Contacts.cpp | |
| parent | add deadline (diff) | |
| download | homework-6-asahellt-3b114c34920b3eb4b56143d432f8bee3ec9b89e6.tar.xz homework-6-asahellt-3b114c34920b3eb4b56143d432f8bee3ec9b89e6.zip | |
Added files
Diffstat (limited to 'Homework6/Contacts.cpp')
| -rw-r--r-- | Homework6/Contacts.cpp | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/Homework6/Contacts.cpp b/Homework6/Contacts.cpp new file mode 100644 index 0000000..08d5342 --- /dev/null +++ b/Homework6/Contacts.cpp @@ -0,0 +1,58 @@ +#include "Contacts.h" +#include <iostream> + +using std::cout; +using std::endl; +using std::cin; + +Contact InputNewContact() { + Contact newContact = {}; + + cout << "Name: "; + cin >> newContact.Name; + + cout << "Email: "; + cin >> newContact.Email; + + cout << "Street Address: "; + cin >> newContact.StreetAddress; + + cout << "City: "; + cin >> newContact.City; + + cout << "State: "; + cin >> newContact.State; + + cout << "Zip: "; + cin >> newContact.Zip; + + return newContact; +} + +void PrintContacts(Contact(&contacts)[10]) { + for (auto &x : contacts) { + cout << "Name: " << x.Name << endl; + cout << "Email: " << x.Email << endl; + cout << "Street Address: " << x.StreetAddress << endl; + cout << "City: " << x.City << endl; + cout << "State: " << x.State << endl; + cout << "Zip: " << x.Zip << endl; + } + +void ContactUpdate(Contact(&contacts)[10]) { + int index; + cin >> index; + + if (index >= 10 && index <= contacts.size()) { + cout << "Enter updated contact name: "; + cin >> contacts[index - 10].Name; + cout << "Enter updated Email: "; + cin >> contacts[index - 10].Email; + cout << "Contact updated successfully!\n"; + } + else { + cout << "Invalid index.\n"; + } + + } +}
\ No newline at end of file |