Kuliah

Tugas akhir struktur data
Tugas akhir mata kuliah struktur data ialah tugas kelompok untuk membuat aplikasi senarai/linked list. berikut ini adalah screen shoot tampilannya:


dan berikut ini adalah source codenya:
#include
#include

struct Senarai
{
int data;
Senarai *next;
};

Senarai *head;

void init()
{
head=NULL;
}

int isempty()
{
if(head==NULL)
return 1;
else return 0;
}

void tambahdata (int databaru)
{
Senarai *baru;
baru= new Senarai;
baru->data =databaru;
baru->next=NULL;

if (isempty()==1)
{
head=baru;
head->next=NULL;
}
else
{
baru->next=head;
head=baru;
}
cout<<"Data Masuk\n";
}

void tampil()
{
Senarai *bantu;
bantu=head;
if(isempty()==0)
{
while (bantu!=NULL)
{
cout<data<next;
}
cout<<endl;
}
else cout<next !=NULL)
{
hapus=head;
d=hapus->data;
head=head->next;
delete hapus;
}
else
{
d=head->data;
head=NULL;
}
cout<<d<<" terhapus\n";
}
else cout<<"masih kosong\n";
}

void main()
{
int pilihan;
int databaru;
do
{
clrscr();
cout<<"TUGAS AKHIR STRUKTUR DATA"<<endl;
cout<<"———Senarai———"<<endl;
cout<<""<<endl;
cout<<"Anggota kelompok:"<<endl;
cout<<""<<endl;
cout<<"1. Frienditya Yuli P (09.5.10093)"<<endl;
cout<<"2. Agus Setyawan (09.5.10105)"<<endl;
cout<<"3. Anik Suprihatin (09.5.10107)"<<endl;
cout<<"4. Catur Prasetyono (09.5.10109)"<<endl;
cout<<""<<endl;
cout<<" MENU PROGRAM:"<<endl;
cout<<""<<endl;
cout<<" 1.Tambah Data"<<endl;
cout<<" 2.Hapus Data"<<endl;
cout<<" 3.Tampilkan Data"<<endl;
cout<<" 4.Keluar"<<endl;
cout<<""<<endl;
cout<>pilihan;
switch(pilihan)
{
{
case 1:
cout<<endl;
cout<>databaru;
tambahdata (databaru);
break;
}
{
case 2:
cout<<endl;
hapusdepan();
;
break;
}
{
case 3:
cout<<endl;
tampil();
break;
}
}
getch();
}while (pilihan!=4);
}

Untuk mendowload aplikasi, klik disini

Tinggalkan Balasan

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Ubah )

Twitter picture

You are commenting using your Twitter account. Log Out / Ubah )

Facebook photo

You are commenting using your Facebook account. Log Out / Ubah )

Connecting to %s