diff options
Diffstat (limited to 'Homework 6/Homework 6/program.cpp')
| -rw-r--r-- | Homework 6/Homework 6/program.cpp | 54 |
1 files changed, 21 insertions, 33 deletions
diff --git a/Homework 6/Homework 6/program.cpp b/Homework 6/Homework 6/program.cpp index 8a01d6d..dcd2a87 100644 --- a/Homework 6/Homework 6/program.cpp +++ b/Homework 6/Homework 6/program.cpp @@ -17,9 +17,10 @@ void Menu() { << "3. Print All Contacts" << endl << "4. Exit" << endl; } -Contact contacts[MAX] = {}; + int main() { + Contact contacts[MAX] = {}; int numberOfContacts = 0; Menu(); @@ -28,16 +29,17 @@ int main() { system("cls"); while (i != 4) { - if (i == 1) - { + int t = 1; + int x = 1; + switch (i) { + case 1: contacts[numberOfContacts] = InputContact(); numberOfContacts++; system("cls"); - } - else if (i == 2) - { + break; + case 2: cout << "\nCurrent contacts: " << endl; - int x = 1; + for (int y = 0; y < numberOfContacts; y++) { cout << "\nContact #: " << x << endl; @@ -59,36 +61,22 @@ int main() { cout << "\n\nEnter the contact # to update it." << endl; int k; cin >> k; - contacts[k-1] = InputContact(); + contacts[k - 1] = InputContact(); + break; + + case 3: + + PrintContacts(contacts, numberOfContacts); + break; + default: + cout << "this was a bad input" << endl; + break; } - else if (i == 3) - { - int t = 1; - for (int i = 0; i < numberOfContacts; i++) { - cout << "\nContact #: " << t << endl; - - cout << "Name: " << contacts[i].Name << endl; - - cout << "Email: " << contacts[i].Email << endl; - - cout << "Street Adress: " << contacts[i].StreetAdress << endl; - - cout << "City: " << contacts[i].City << endl; - - cout << "State: " << contacts[i].State << endl; - cout << "Zip: " << contacts[i].Zip << endl; - - t = t + 1; - } - } - - int j; Menu(); - - cin >> j; - i = j; + cin >> i; system("cls"); + } return 0; } |