-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLinkedListsProgram.h
More file actions
107 lines (74 loc) · 2.56 KB
/
Copy pathLinkedListsProgram.h
File metadata and controls
107 lines (74 loc) · 2.56 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
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
#include<iostream>
#include"ListsUsingLinked.h"
using namespace std;
typedef int ChoiceType;
void Menu() {
cout << "\n\n====================================\n";
cout << "LIST (LINKED LISTS) PROGRAM\n";
cout << "====================================\n";
cout << "There are currently " << LinkedListCountItems() << " items in the list.\n"; // TODO: insert linked list counter here
cout << endl
<< endl;
cout << "====================================\n";
cout << "Options:\n";
cout << "(1). Initialize items to the list\n"
<< "(2). Insert item in between list\n"
<< "(3). Delete Item From The list\n"
<< "(4). Locate Items in the list\n"
<< "(5). Print Items in the list\n"
<< "(6). Exit Program\n"
<< "====================================\n";
cout << endl
<< endl;
}
USER_INPUT ChoicePicker()
{
USER_INPUT Choice;
cout << "Enter the number of your choice: ";
cin >> Choice;
while ((Choice < 1) || (Choice > 6))
{
cout << "Invalid Choice! Please try again!\n"
<< "Enter the number of your choice (1-6): ";
cin >> Choice;
}
return Choice;
}
void LinkedMain() {
USER_INPUT Choice, NewData, deleteData, searchData;
LIST_SIZE numberOfNodes, nodePosition;
Menu();
do{
Choice = ChoicePicker();
switch (Choice) {
case 1:
cout << "\nEnter the number of nodes to make: ";
cin >> numberOfNodes;
LinkedListAddItems(numberOfNodes);
break;
case 2:
cout << "\nEnter Position: ";
cin >> nodePosition;
cout << "Enter data: ";
cin >> NewData;
LinkedListInsertItems(NewData, nodePosition);
break;
case 3:
cout << "\nEnter Data to Delete: ";
cin >> deleteData;
LinkedListDeleteItems(deleteData);
break;
case 4:
cout << "\nEnter Search Data: ";
cin >> searchData;
LinkedListLocateItems(searchData);
break;
case 5:
LinkedListPrintItems();
break;
default:
cout << "Thank you for using this program\n"
<< "Goodbye!";
}
}while(Choice!=6);
}