diff options
| author | Connor McDowell <[email protected]> | 2024-02-19 16:12:31 -0800 |
|---|---|---|
| committer | Connor McDowell <[email protected]> | 2024-02-19 16:12:31 -0800 |
| commit | e2b6fbcc7c708d277443818bb36b33c4e943b5d7 (patch) | |
| tree | 8709dd8f5119b1c95bdbbe0c6eeb47f1591b0dbf /Project1 | |
| parent | print fixed (diff) | |
| download | homework-5-connormcdowell275-main.tar.xz homework-5-connormcdowell275-main.zip | |
Diffstat (limited to 'Project1')
| -rw-r--r-- | Project1/contacts.cpp | 45 | ||||
| -rw-r--r-- | Project1/program.cpp | 2 |
2 files changed, 24 insertions, 23 deletions
diff --git a/Project1/contacts.cpp b/Project1/contacts.cpp index f4a89aa..573a8a7 100644 --- a/Project1/contacts.cpp +++ b/Project1/contacts.cpp @@ -26,6 +26,7 @@ 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; @@ -37,6 +38,7 @@ char addNew(contact newContact[], size_t MAX, int t) 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; @@ -55,30 +57,29 @@ char addNew(contact newContact[], size_t MAX, int t) void update(struct contact newContact[], size_t MAX) { - cout << "select a contact to delete" << endl; - int i = 0; + 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 >> i; - i = i - 1; - if (i == newContact[i].id) { - cin >> c; - if (c == 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 << "enter Zip: " << endl; - cin >> newContact[i].Zip; - } + 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) diff --git a/Project1/program.cpp b/Project1/program.cpp index 4336284..4cd817d 100644 --- a/Project1/program.cpp +++ b/Project1/program.cpp @@ -43,7 +43,7 @@ int main() { addNew(&newContact[MAX], MAX, t); ++t; - cout << t << endl; + //cout << t << endl; } if (c == 2) { |