#include <stdio.h>
#include <stdlib.h>
#include "tp5.c"
int main()
{
int pil;
InfoParent x,cari;
InfoChild y;
char dump;
List A;
addressParent p;
addressChild q;
CreateList(&A);
do
{
system("cls");
printf("Menu Multi List\n");
printf("1. Insert First\n");
printf("2. Insert Child\n");
printf("3. Delete Parent\n");
printf("4. View\n");
printf("5. Exit\n");
printf("PILIHAN <1-5> : ");
scanf("%d",&pil);
scanf("%c",&dump);
switch(pil)
{
case 1 :
printf("Masukan Parentnya : ");
scanf("%s",&x);
p=alokasiParent(x);
InsertFirstParent(&A,p);
break;
case 2 :
printf("Masukan Parentnya : ");
scanf("%s",&cari);
p=search(A,cari);
if(first(A)==nil)
{
printf("List Kosong");
}
else
{
if(p==nil)
{
printf("Parent tidak ada");
}
else
{
printf("Masukan Childnya : ");
scanf("%s",&y);
q=alokasiChild(y);
InsertFirstChild(&p,q);
}
}
break;
case 3 :
DeleteFirstParent(&A);
break;
case 4 :
system("cls");
View(A);
break;
case 5 :
printf("Terima Kasih");
break;
default :
printf("Keyword Salah");
}getche();
}while(pil!=5);
return 0;
}
#include <stdlib.h>
#include "tp5.c"
int main()
{
int pil;
InfoParent x,cari;
InfoChild y;
char dump;
List A;
addressParent p;
addressChild q;
CreateList(&A);
do
{
system("cls");
printf("Menu Multi List\n");
printf("1. Insert First\n");
printf("2. Insert Child\n");
printf("3. Delete Parent\n");
printf("4. View\n");
printf("5. Exit\n");
printf("PILIHAN <1-5> : ");
scanf("%d",&pil);
scanf("%c",&dump);
switch(pil)
{
case 1 :
printf("Masukan Parentnya : ");
scanf("%s",&x);
p=alokasiParent(x);
InsertFirstParent(&A,p);
break;
case 2 :
printf("Masukan Parentnya : ");
scanf("%s",&cari);
p=search(A,cari);
if(first(A)==nil)
{
printf("List Kosong");
}
else
{
if(p==nil)
{
printf("Parent tidak ada");
}
else
{
printf("Masukan Childnya : ");
scanf("%s",&y);
q=alokasiChild(y);
InsertFirstChild(&p,q);
}
}
break;
case 3 :
DeleteFirstParent(&A);
break;
case 4 :
system("cls");
View(A);
break;
case 5 :
printf("Terima Kasih");
break;
default :
printf("Keyword Salah");
}getche();
}while(pil!=5);
return 0;
}