aboutsummaryrefslogtreecommitdiff
path: root/Project1/program.cpp
blob: 5b28a17dd1bf762e5b7c9dee8899d3e7482418e6 (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
95
96
97
98
99
100
101
102
103
104
105
106
// name: Connor McDowell
// date: 2/19/2024
// class: CST116
// reason: homework number 6

#include "Contact_list.h"
#include <iostream>

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

//constexpr size_t MAX = 3;

int main()
{
    size_t MAX = 3;
    int O = 1;
 /*    t = index counter*/
    contact newContact;
    //contact* newContact = new contact[MAX];
    contact_list contacts(MAX);

	size_t t = 0;
    contacts.set_size(MAX);
    while (O == 1)
    {
        //cout << MAX << endl;
        // c = choice input
        int c = 0;
        cout << "1. Enter a contact\n";
        cout << "2. Update a contact\n";
        cout << "3. print all contacts\n";
        cout << "4. Delete a contact\n";
        cout << "5. Quit\n";
        cout << "\nEnter your choice: " << endl;
        cin >> c;
        switch (c)
        {
        case 1:
            //addNew(newContact, MAX, t);
            //contacts.AddContact(newContact);
            //addContact(newContact, contacts.get_size(), contacts[MAX]);
            for (auto i = 0u; i < MAX; ++i)
            {
                char firstName[30];
                char lastName[30];
                char Email[105];
                char StreetAddress[45];
                char City[35];
                char State[4];
                int Zip = 0;
                newContact.Set_a(0);
                newContact.Set_id(i + 1);
                //newContact[i].count = t;
                cin.ignore(1000, '\n');
                cout << "Please enter each piece of information when you are prompted to" << endl;
                cout << "enter first name: " << endl;
                cin >> firstName;
                newContact.Set_firstName(firstName);
                cout << "enter last name: " << endl;
                cin >> lastName;
                newContact.Set_lastName(lastName);
                cout << "enter Email: " << endl;
                cin >> Email;
                newContact.Set_email(Email);
                cout << "enter Street Address: " << endl;
                cin >> StreetAddress;
                newContact.Set_streetAddress(StreetAddress);
                cout << "enter city: " << endl;
                cin >> City;
                newContact.Set_city(City);
                cout << "enter State as two letter abbreviation: " << endl;
                cin >> State;
                newContact.Set_state(State);
                cout << "Please enter the next value as a series of numbers" << endl;
                cout << "enter Zip: " << endl;
                cin >> Zip;
                newContact.Set_zip(Zip);
                size_t id = i + 1;
                newContact.Set_id(id);
                newContact.print();
                break;
            }
            contacts.AddContact(newContact);
            break;
        case 2:
            //contacts.Update(newContact);
            cout << "this program is currently a work in progress" << endl;
            break;
        case 3:
            contacts.Print(); // Print only the existing contacts
            break;
        case 4:
            contacts.DeleteContact(newContact);
            //contacts.CopyList(&newContact, MAX);
            break;
        case 5:
            O = 0;
            break;
        default:
            cout << "Invalid choice. Please enter a number from 1 to 5." << endl;
        }
    }
    return 0;
}