forked from ASD-ADF/ASD_Task_3
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDhiva
More file actions
49 lines (48 loc) · 919 Bytes
/
Dhiva
File metadata and controls
49 lines (48 loc) · 919 Bytes
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
void insert_after(node *p, node *prec)
{
p = allocate();
prec = allocate();
int x;
cout<<"Insert After"<<endl<<endl;
cout<<"Insert Data After Data ID : ";
cin>>x; cout<<endl<<endl;
prec = search_Element_ID(x);
if (prec == NULL)
{
cout<<"ID was not found!"<<endl;
}
else
{
inserting(p);
p->next = prec->next;
prec->next = p;
cout<<endl<<"Insert Success!"<<endl;
}
_getch();
}
void delete_first(node *p)
{
if(head == NULL)
{
cout<<"Data is Empty!"<<endl;
_getch();
}
else
{
p = allocate();
p = head;
if(p->next == NULL)
{
head = NULL;
delete p;
}
else
{
head = p->next;
p->next = NULL;
delete p;
}
cout<<"Delete Success!"<<endl;
_getch();
}
}