-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmenu.c
58 lines (54 loc) · 1.39 KB
/
menu.c
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
#include"avl/avl.c"
#define clear system("clear")
int main()
{
tree* my_tree = new_tree();
int temp = 0;
while(1)
{
// clear;
printf("--------------------\n");
Graph(my_tree->Root);
printf("\n1. Insertion\n2. Deletion\n3. Search \n ");
scanf("%d", &temp);
if( temp == 1)
{
printf("\nEnter a number for insertion( -1 for termination ):-\t");
scanf("%d", &temp);
if( temp == -1 ){
break;
}
else {
add_t(my_tree, temp);
}
}
else if(temp == 2)
{
printf("\nEnter a number for deletion( -1 for termination ):-\t");
scanf("%d", &temp);
if( temp == -1 ){
break;
}
else{
remove_t(my_tree, temp);
}
} else {
printf("\nEnter a number for deletion( -1 for termination ):-\t");
scanf("%d", &temp);
if( temp == -1 ){
break;
}
else{
int ret = find_t(my_tree, temp);
if(ret == 0){
printf("Not found.\n");
} else {
printf("Found.\n");
}
getchar();
}
}
}
delete_tree(my_tree);
return 0;
}