-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContactBST.cpp
More file actions
59 lines (50 loc) · 1.85 KB
/
ContactBST.cpp
File metadata and controls
59 lines (50 loc) · 1.85 KB
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
// ContactBST.cpp : This file created by Anthony Huerta
#include <iostream>
#include<cstdlib>
#include "ContactTree.h"
using namespace std;
int main()
{
ContactTree contacts;
long long phoneNumber = 0;
string emailAddress = "";
bool userCheck = true;
int userChoice = 0;
cout << "Hello! Welcome to the Contact Binary Search Tree program" << endl;
cout << "=========================================================" << endl;
//While loop which continues to run until the User inputs a bad input or until option 4 ins selected.
while (userCheck) {
cout << "Please Select from one of the options below" << endl << endl;
cout << "1. Add your phone number and email address" << endl;
cout << "2. Add a new contact's phone number and email address" << endl;
cout << "3. Print out all saved contacts" << endl;
cout << "4. Close the program" << endl << endl;
cin >> userChoice;
if (userChoice == 1) {
cout << "What is your phone number? (ex: 8004797755)" << endl;
cin >> phoneNumber;
cout << endl << "What is your email address? (ex: JaneDoe66@gmail.com)" << endl;
cin >> emailAddress;
contacts.insert(phoneNumber, emailAddress);
}
else if (userChoice == 2) {
cout << "What is this Contact's phone number? (ex: 8004797755)" << endl;
cin >> phoneNumber;
cout << endl << "What is this Contact's email address? (ex: JaneDoe66@gmail.com)" << endl;
cin >> emailAddress;
contacts.insert(phoneNumber, emailAddress);
}
else if (userChoice == 3) {
contacts.display();
}
else if (userChoice == 4) {
userCheck = false;
}
else if (userChoice != 1 || userChoice != 2 || userChoice != 3 || userChoice != 4)
{
cout << "Incorrect input, Program is exiting" << endl;
break;
}
}
cout << endl << "Thank you for using the Contact Binary Search Tree program" << endl;
}