-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
116 lines (113 loc) · 3.37 KB
/
Copy pathmain.cpp
File metadata and controls
116 lines (113 loc) · 3.37 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
108
109
110
111
112
113
114
115
116
#include <iostream>
#include "Functions.h"
using namespace std;
int main() {
pNode head = nullptr;
pNode head_1 = nullptr;
pNode tmp = nullptr;
pNode tmp_1 =nullptr;
int batHeadNum = 0;
int choice = 0;
printChoice();
while (choice != 19){
cout << "Enter your choice : ";
cin >> choice;
switch (choice) {
case 1:
allocMemoryForNodes(head);
break;
case 2:
fillingNodes(head);
break;
case 3:
if(head)
printList(head);
else
cout << "Empety list" << endl;
break;
case 4:
tmp = searchNode(head);
if( tmp )
cout << " Node tmp right now : id = "<< tmp->id << endl;
break;
case 5:
if(tmp)
changeNode(tmp);
else
cout << "At first find node" << endl;
break;
case 6:
if(tmp)
exchange(head, tmp);
else
cout << "At first find first node" << endl;
break;
case 7:
sort(head);
break;
case 8:
swap(head,head_1);
swap(tmp , tmp_1);
break;
case 9:
if(tmp) {
separationOfList(head_1, tmp);
tmp = nullptr;
tmp_1 = nullptr;
}
else
cout << "At first find first node" << endl;
break;
case 10:
if (head && head_1) {
connectLists(head, head_1);
tmp = nullptr;
tmp_1 = nullptr;
} else
cout << "No exist some list" << endl;
break;
case 11:
if(tmp)
insertNode(head, tmp);
else
cout << "At first find node" << endl;
break;
case 12:
if(tmp) {
deleteOldNode(head, tmp);
tmp = nullptr;
}
else
cout << "At first find node" << endl;
break;
case 13:
readFromFile(head);
break;
case 14:
writeToFile(head);
break;
case 15:
cout << "Your last host address : " << lastAdress(head) << endl;
break;
case 16:
cout << "Right now at list : " << countNodes(head) << " elements"<< endl;
break;
case 17:
freeMemory(head);
(head != nullptr)? cout << "curent list full": cout << "curent list Empty";
cout << endl;
(head_1 != nullptr)? cout << "another list full": cout << "another list Empty";
cout << endl;
break;
case 18:
printChoice();
break;
case 19:
break;
default:
cout << "Try again" << endl;
break;
}
}
return 0;
}