aboutsummaryrefslogtreecommitdiff
path: root/Project1/contacts.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Project1/contacts.cpp')
-rw-r--r--Project1/contacts.cpp56
1 files changed, 29 insertions, 27 deletions
diff --git a/Project1/contacts.cpp b/Project1/contacts.cpp
index 6f29040..29b2f47 100644
--- a/Project1/contacts.cpp
+++ b/Project1/contacts.cpp
@@ -7,8 +7,6 @@ using std::cin;
using std::cout;
using std::endl;
-constexpr int MAX = 100;
-
int menu()
{
int c;
@@ -24,7 +22,7 @@ int menu()
return c;
}
-char addNew(contact* newContact, size_t MAX)
+char addNew(contact newContact[], size_t MAX)
{
int i = 0;
@@ -35,19 +33,19 @@ char addNew(contact* newContact, size_t MAX)
cout << "works!" << endl;
for (int i = 0; i < MAX; i++)
{
- newContact->id = i + 1;
+ newContact[i].id = i + 1;
cout << "enter name: " << endl;
- cin >> newContact->Name;
+ cin >> newContact[i].Name;
cout << "enter Email: " << endl;
- cin >> newContact->Email;
+ cin >> newContact[i].Email;
cout << "enter Street Address: " << endl;
- cin >> newContact->StreetAddress;
+ cin >> newContact[i].StreetAddress;
cout << "enter city: " << endl;
- cin >> newContact->City;
+ cin >> newContact[i].City;
cout << "enter State: " << endl;
- cin >> newContact->State;
+ cin >> newContact[i].State;
cout << "enter Zip: " << endl;
- cin >> newContact->Zip;
+ 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;
@@ -62,35 +60,39 @@ char addNew(contact* newContact, size_t MAX)
// state
// zip
-void update(struct contact* newContact, size_t MAX)
+void update(struct contact newContact[], size_t MAX)
{
+ cout << "select a contact to delete" << endl;
int i = 0;
int c = 0;
cin >> i;
i = i - 1;
- newContact->id;
- cin >> c;
- if (c == 1)
- {
- cout << "enter name: " << endl;
- cin >> newContact->Name;
- cout << "enter Email: " << endl;
- cin >> newContact->Email;
- cout << "enter Street Address: " << endl;
- cin >> newContact->StreetAddress;
- cout << "enter city: " << endl;
- cin >> newContact->City;
- cout << "enter State: " << endl;
- cin >> newContact->State;
- cout << "enter Zip: " << endl;
- cin >> newContact->Zip;
+ 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;
+ }
}
+
}
void printAll(contact newContact, size_t MAX)
{
for (int i = 0; i < MAX; ++i)
{
+ cout << newContact.id << endl;
cout << "name: " << newContact.Name << endl;
cout << "Email: " << newContact.Email << endl;
cout << "Address: " << newContact.StreetAddress << endl;