#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
struct TNode {
char nim[30];
char nama[30];
TNode *next;
};
void init(){
head = NULL;
tail = NULL;
int isEmpty(){
else return 0;
void tambahDepan(){
TNode *baru;
baru->next = NULL;
if(isEmpty()==1){
head=tail=baru;
tail->next=NULL;
else {
baru->next = head;
head = baru;
printf("Data masuk\n");
void tambahBelakang(){
TNode *baru,*bantu;
cout << "Masukkan Data lengkap di bawah ini : " << endl;
baru->next = NULL;
if(isEmpty()==1){
head=baru;
tail=baru;
tail->next = NULL;
else {
tail->next = baru;
tail=baru;
printf("Data masuk\n");
void hapusDepan(){
TNode *hapus;
if (isEmpty()==0){
if(head!=tail){
hapus = head;
ni = hapus->nim;
na = hapus->nama;
head = head->next;
delete hapus;
} else {
ni = tail->nim;
na = tail->nama;
head=tail=NULL;
void hapusBelakang(){
TNode *bantu,*hapus;
if (isEmpty()==0){
bantu = head;
if(head!=tail){
while(bantu->next!=tail){
bantu = bantu->next;
hapus = tail;
tail=bantu;
ni = hapus->nim;
na = hapus->nama;
delete hapus;
tail->next = NULL;
}else {
ni = tail->nim;
na = tail->nama;
head=tail=NULL;
}
void tampil(){
int no = 1;
TNode *bantu;
bantu=head;
if(isEmpty()==0){
while(bantu!=NULL){
no++;
bantu=bantu->next;
else
if (caridata == nim){
getch();
}
main(){
do{
system("cls");
cout<<"*************"<<endl;
cout<<"MENU PILIHAN"<<endl;
cout<<"*************"<<endl;
cout<<"1.Insert Depan"<<endl;
cout<<"2.Insert Belakang"<<endl;
cout<<"3.Display"<<endl;
cout<<"4.Delete Depan"<<endl;
cout<<"5.Delete Belakang"<<endl;
cout<<"6.Cari Nama"<<endl;
cout<<"7.Exit"<<endl;
switch(pil){
isEmpty();
tambahDepan();
break;
break;
isEmpty();
tambahBelakang();
break;
isEmpty();
tampil();
break;
isEmpty();
hapusDepan();
break;
isEmpty();
hapusBelakang();
break;
isEmpty();
search(caridata);
getch();
}while(pil!='7');
return 0;