forked from ASD-ADF/ASD_Task_3
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathHasan
More file actions
65 lines (64 loc) · 1.58 KB
/
Hasan
File metadata and controls
65 lines (64 loc) · 1.58 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
void delete_after(node *p, node *prec)
{
if(head == NULL)
{
cout<<"Data is Empty!"<<endl;
_getch();
}
else
{
int x;
p = allocate();
prec = allocate();
cout<<"Delete After"<<endl<<endl;
cout<<"Delete Data After Data ID : "<<endl;
cin>>x;
prec = search_Element_ID(x);
if (prec == NULL)
{
cout<<"Data was not found!"<<endl;
}
else
{
if (prec->next == NULL)
{
cout<<"The Data you choose is the Last Data!"<<endl;
}
else
{
p = prec->next;
prec->next = p->next;
p->next = NULL;
cout<<"Delete Success!"<<endl;
}
}
_getch();
}
}
void view_data(node *p)
{
p = new node;
p = head;
if (head == NULL)
{
cout<<"Data Mahasiswa is Empty!"<<endl;
}
else
{
cout<<"ID : "<<p->info.id<<endl;
cout<<"Name : "<<p->info.nama<<endl;
cout<<"Born : "<<p->info.lahir<<endl;
cout<<"Class : "<<p->info.kelas<<endl;
cout<<"Phone : "<<p->info.telpon<<endl<<endl;
while (p->next != NULL)
{
p = p->next;
cout<<"ID : "<<p->info.id<<endl;
cout<<"Name : "<<p->info.nama<<endl;
cout<<"Born : "<<p->info.lahir<<endl;
cout<<"Class : "<<p->info.kelas<<endl;
cout<<"Phone : "<<p->info.telpon<<endl<<endl;
}
}
_getch();
}