aboutsummaryrefslogtreecommitdiff
path: root/Project1/contacts.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Project1/contacts.cpp')
-rw-r--r--Project1/contacts.cpp107
1 files changed, 64 insertions, 43 deletions
diff --git a/Project1/contacts.cpp b/Project1/contacts.cpp
index bafd648..f932281 100644
--- a/Project1/contacts.cpp
+++ b/Project1/contacts.cpp
@@ -6,59 +6,80 @@
using std::cin;
using std::cout;
using std::endl;
-using std::list;
-using std::vector;
+constexpr int MAX = 100;
-struct contact
+int menu()
{
- int id = 0;
- char Name[25] = {};
- char Email[100] = {};
- char StreetAddress[35] = {};
- char City[30] = {};
- char State[2] = {};
- int Zip = 97034;
-};
-
-contact myArrays(contact newContact)
-{
- int i = 0;
- std::list<contact> myList(100, newContact);
- for (auto i = 0; i < 100; i++)
- {
- newContact.id = i;
- addNew();
- myList.push_back(newContact);
- }
- cout << newContact.id << endl;
- return newContact;
+ 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()
+char addNew(contact newContact)
{
- // prompt user input w/o spaces
-
-
+
+ int i = 0;
+ int c = 0;
+ cin >> c;
+ if (c == 1)
+ {
+ cout << "works!" << endl;
+ for (int i = 0; i < 10; i++)
+ {
+ cin >> newContact[i].Name;
+ cin >> newContact[i].Email;
+ cin >> newContact[i].StreetAddress;
+ cin >> newContact[i].City;
+ cin >> newContact[i].State;
+ 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;
+ }
+}
- contact newContact[i];
- cin >> newContact[i].Name;
- cout << newContact[i].Name << endl;
- cin >> newContact[i].Email;
- cout << newContact[i].Email << endl;
- cin >> newContact[i].StreetAddress;
- cout << newContact[i].StreetAddress << endl;
- cin >> newContact[i].City;
- cout << newContact[i].City << endl;
- cin >> newContact[i].State;
- cout << newContact[i].State << endl;
- cin >> newContact[i].Zip;
- cout << newContact[i].Zip << endl;
+//struct contact_list
+//{
+// contact contact[MAX_CONTACTS];
+// int count;
+//};
+//int contacts_insert_new(contact_list contacts, contact newContact)
+//{
+// memcpy(&contacts->contact[contacts->count++], newContact);
+//
+//}
- return 0;
-}
+//char addNew()
+//{
+// contact newContact;
+// cin >> newContact.Name;
+// cout << newContact.Name << endl;
+// cin >> newContact.Email;
+// cout << newContact.Email << endl;
+// cin >> newContact.StreetAddress;
+// cout << newContact.StreetAddress << endl;
+// cin >> newContact.City;
+// cout << newContact.City << endl;
+// cin >> newContact.State;
+// cout << newContact.State << endl;
+// cin >> newContact.Zip;
+// cout << newContact.Zip << endl;
+//
+//
+//
+// return 0;
+//}
//for (auto const& i : name)
//{