aboutsummaryrefslogtreecommitdiff
path: root/Homework 5/Homework 5/program.cpp
blob: 22b37d2f37752dfbef07b3ff2179d76e67c2766a (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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
// Name: Nataliia Brown
// Date: 2/12/24
// Class: CST 116
// Assignment: Homework 5

#include "Contacts.h"

#include <iostream>
#include<list>
#include <vector>

using namespace std;


void Menu() {
	cout << "Please choose option from 1 to 4:" << endl << "1. Add New Contact" << endl << "2. Update Contact" << endl
		<< "3. Print All Contacts" << endl << "4. Exit" << endl;
}



void main(){

	Menu();

	int i;
	cin >> i;
	
	vector<Contact>vecContacts;

	while (i != 4) {

		if (i == 1)
		{
			system("cls");
			cout << "1: " << endl;

			vecContacts.push_back(InputPersonalInfo());
		}

		else if (i == 2)
			{
			//system("cls");

			cout << "Modifying Contact: " << endl;

			/*void ModifyContacts(vector<Contact> &contact, string name, string new_name) {
				vector<Contact>::iterator it;
				for (it = contact.begin(); it != contact.end(); it++)
				{
					if (it->Name == name)
					{
						it->Name = new_name;
						break;
					}

				}
			}*/
			/*UpdateContact()
			
			UserDob newUser = InputPersonalInfo();
			PrintUserInfo(newUser); - Update all fields for the same email*/
			}
		else if (i == 3)
			{
			//system("cls");
			cout << "3: " << endl;
			for (int count = 0; count < vecContacts.size(); count++)
			{
				cout << "\nName: " << vecContacts[count].Name << "\nEmail: " << vecContacts[count].Email << "\nStreet Adress: " << vecContacts[count].StreetAdress << "\nCity: " << vecContacts[count].City << "\nState: " << vecContacts[count].State << "\nZip: " << vecContacts[count].Zip << endl;
			}
			cout << endl;
			
			}
		//system("cls");
		int j;
		Menu();

		cin >> j;
		i = j;
		
		
		
	}
		
	


}










//void Print100(size_t n) {
//	for (int j = 0; j <= n; j++) {
//		cout << j << " ";
//	}
//	cout << endl;
//}
//
//void PrintFibonacci(size_t n) {
//	int k, t1 = 0, t2 = 1, nextTerm = 0;
//
//	cout << "Enter the number of terms: ";
//	cin >> k;
//
//	cout << "Fibonacci Series: ";
//
//	for (int i = 1; i <= k; ++i) {
//
//		if (i == 1) {
//			cout << t1 << " ";
//			continue;
//		}
//		if (i == 2) {
//			cout << t2 << " ";
//			continue;
//		}
//		nextTerm = t1 + t2;
//		t1 = t2;
//		t2 = nextTerm;
//
//		cout << nextTerm << " ";
//	}
//
//
//}
//
//struct UserDob
//{
//	int day;
//	int month;
//	int year;
//};
//
//UserDob InputPersonalInfo()
//{
//	UserDob user = {};
//
//	cout << "\nDay: ";
//	cin >> user.day;
//
//	cout << "Month: ";
//	cin >> user.month;
//
//	cout << "Year: ";
//	cin >> user.year;
//
//	return user;
//
//}
//
//void PrintUserInfo(UserDob newUser) {
//
//	cout << "User's DOB: " << newUser.month << "/" << newUser.day << "/" << newUser.year << endl;
//}
//
//int main() {
//	int i;
//	Menu();
//	cin >> i;
//
//
//	while (i != 4) {
//		system("cls");
//		if (i == 1)
//
//		{
//			cout << "Enter the number for Print 100 function: ";
//			int n;
//			cin >> n;
//			Print100(n);
//		}
//		else if (i == 2)
//		{
//			UserDob newUser = InputPersonalInfo();
//			PrintUserInfo(newUser);
//		}
//		else if (i == 3)
//		{
//			PrintFibonacci(i);
//		}
//
//
//		int j;
//		Menu();
//
//		cin >> j;
//		i = j;
//	}
//
//	return 0;
//}