diff options
| author | Connor McDowell <[email protected]> | 2024-02-19 16:16:40 -0800 |
|---|---|---|
| committer | Connor McDowell <[email protected]> | 2024-02-19 16:16:40 -0800 |
| commit | 1ea9952ccd3168e629600c48d0ffaee53f9cb158 (patch) | |
| tree | 6290efb7d5ed77e6dc5d3e8cb6ea0ccd094420e1 /Project1/contacts.cpp | |
| parent | add deadline (diff) | |
| download | homework-6-connormcdowell275-1ea9952ccd3168e629600c48d0ffaee53f9cb158.tar.xz homework-6-connormcdowell275-1ea9952ccd3168e629600c48d0ffaee53f9cb158.zip | |
.cpps and .hs added
Diffstat (limited to 'Project1/contacts.cpp')
| -rw-r--r-- | Project1/contacts.cpp | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/Project1/contacts.cpp b/Project1/contacts.cpp new file mode 100644 index 0000000..573a8a7 --- /dev/null +++ b/Project1/contacts.cpp @@ -0,0 +1,110 @@ +#include "Contacts.h" +#include <iostream> +#include <list> +#include <vector> + +using std::cin; +using std::cout; +using std::endl; + +int menu() +{ + int c; + + cout << "1. Enter a name\n"; + cout << "2. Delete a name\n"; + cout << "3. List the file\n"; + cout << "4. Quit\n"; + do { + cout <<"\nEnter your choice: "; + cin >> c; + } while (c < 0 || c>4); + return c; +} + +char addNew(contact newContact[], size_t MAX, int t) +{ + for (int i = t; i < MAX; i++) + { + cout << "Please enter all inputs as english characters with underscores (_) for spaces" << endl; + newContact[i].id = i + 1; + cout << "enter name: " << endl; + cin >> newContact[i].Name; + cout << "enter Email: " << endl; + cin >> newContact[i].Email; + cout << "enter Street Address: " << endl; + cin >> newContact[i].StreetAddress; + cout << "enter city: " << endl; + cin >> newContact[i].City; + cout << "enter State: " << endl; + cin >> newContact[i].State; + cout << "Please enter the next value as a series of numbers" << endl; + cout << "enter Zip: " << endl; + 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; + return 0; +} +// print contact i +// name: +// email +// address +// city +// state +// zip + +void update(struct contact newContact[], size_t MAX) +{ + cout << "select a contact to update based on their position in the list (check print all contacts for list position)" << endl; + int c = 0; + cin >> c; + int t = c - 1; + for (int i = t; i < MAX;) + { + cout << "Please enter all inputs as english characters with underscores (_) for spaces" << endl; + newContact[i].id = c; + cout << "enter name: " << endl; + cin >> newContact[i].Name; + cout << "enter Email: " << endl; + cin >> newContact[i].Email; + cout << "enter Street Address: " << endl; + cin >> newContact[i].StreetAddress; + cout << "enter city: " << endl; + cin >> newContact[i].City; + cout << "enter State: " << endl; + cin >> newContact[i].State; + cout << "Please enter the next value as a series of numbers" << endl; + cout << "enter Zip: " << endl; + cin >> newContact[i].Zip; + break; + } +} + +void printAll(contact newContact[], size_t MAX) +{ + for (int i = 0; i < MAX; ++i) + { + /*for (int t = -1; t < newContact[i].id;) { + break; + }*/ + if (newContact[i].id == 0) { + break; + } + if (newContact[i].id < 0) { + break; + } + if (newContact[i].id > MAX) { + break; + } + + cout << "List number: " << newContact[i].id << endl; + cout << "name: " << newContact[i].Name << endl; + cout << "Email: " << newContact[i].Email << endl; + cout << "Address: " << newContact[i].StreetAddress << endl; + cout << "city: " << newContact[i].City << endl; + cout << "state: " << newContact[i].State << endl; + cout << "Zip: " << newContact[i].Zip << endl; + } +} |