diff options
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 |