aboutsummaryrefslogtreecommitdiff
path: root/Project1/contacts.cpp
blob: 2a5451602713c2f4aa97858f8a0e217cf4c8142e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#include "Contacts.h"
#include <iostream>
#include <list>
#include <vector>

using std::cin;
using std::cout;
using std::endl;

constexpr int MAX = 100;

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[])
{

    int i = 0;
    int c = 0;
    cin >> c;
    if (c == 1)
    {
        cout << "works!" << endl;
        for (int i = 0; i < 10; i++)
        {
            newContact[i]->id = i + 1;
            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;
    }
    return 0;
}
// print contact i
// name:
// email
// address
// city
// state
// zip

void update(contact* newContact[])
{
    int i = 0;
    int c = 0;
    cin >> i;
    i = i - 1;
    newContact[i]->id;
    cin >> c;
    if (c = 1)
    {
        cin >> newContact[i]->Name;
        cin >> newContact[i]->Email;
        cin >> newContact[i]->StreetAddress;
        cin >> newContact[i]->City;
        cin >> newContact[i]->State;
        cin >> newContact[i]->Zip;
    }
}


//struct contact_list
//{
//	contact contact[MAX_CONTACTS];
//	int count;
//};

//int contacts_insert_new(contact_list contacts, contact newContact)
//{
//	memcpy(&contacts->contact[contacts->count++], newContact);
//	
//}

// add: prompt add, get cin for contact.name contact.email contact.address contact.city and contact.zip
// add update: find struct through name value (if contact.name == i = cin pull up that struct and do similar
// to add) and save over it
// add: print all contacts.