diff options
Diffstat (limited to 'Project1/contacts.cpp')
| -rw-r--r-- | Project1/contacts.cpp | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/Project1/contacts.cpp b/Project1/contacts.cpp index 036f899..6f29040 100644 --- a/Project1/contacts.cpp +++ b/Project1/contacts.cpp @@ -24,7 +24,7 @@ int menu() return c; } -char addNew(contact* newContact[]) +char addNew(contact* newContact, size_t MAX) { int i = 0; @@ -33,24 +33,24 @@ char addNew(contact* newContact[]) if (c == 1) { cout << "works!" << endl; - for (int i = 0; i < 10; i++) + for (int i = 0; i < MAX; i++) { - newContact[i]->id = i + 1; + newContact->id = i + 1; cout << "enter name: " << endl; - cin >> newContact[i]->Name; + cin >> newContact->Name; cout << "enter Email: " << endl; - cin >> newContact[i]->Email; + cin >> newContact->Email; cout << "enter Street Address: " << endl; - cin >> newContact[i]->StreetAddress; + cin >> newContact->StreetAddress; cout << "enter city: " << endl; - cin >> newContact[i]->City; + cin >> newContact->City; cout << "enter State: " << endl; - cin >> newContact[i]->State; + cin >> newContact->State; cout << "enter Zip: " << endl; - cin >> newContact[i]->Zip; + cin >> newContact->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; + //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; } @@ -62,40 +62,40 @@ char addNew(contact* newContact[]) // state // zip -void update(contact* newContact[]) +void update(struct contact* newContact, size_t MAX) { int i = 0; int c = 0; cin >> i; i = i - 1; - newContact[i]->id; + newContact->id; cin >> c; - if (c = 1) + if (c == 1) { cout << "enter name: " << endl; - cin >> newContact[i]->Name; + cin >> newContact->Name; cout << "enter Email: " << endl; - cin >> newContact[i]->Email; + cin >> newContact->Email; cout << "enter Street Address: " << endl; - cin >> newContact[i]->StreetAddress; + cin >> newContact->StreetAddress; cout << "enter city: " << endl; - cin >> newContact[i]->City; + cin >> newContact->City; cout << "enter State: " << endl; - cin >> newContact[i]->State; + cin >> newContact->State; cout << "enter Zip: " << endl; - cin >> newContact[i]->Zip; + cin >> newContact->Zip; } } -void printAll(contact* newContact[]) +void printAll(contact newContact, size_t MAX) { - for (int i = 0; i < newContact[i]->id; ++i) + for (int i = 0; i < MAX; ++i) { - 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; + cout << "name: " << newContact.Name << endl; + cout << "Email: " << newContact.Email << endl; + cout << "Address: " << newContact.StreetAddress << endl; + cout << "city" << newContact.City << endl; + cout << "state: " << newContact.State << endl; + cout << "Zip: " << newContact.Zip << endl; } } |