Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include #include #include #include using namespace std; int pilih; void pilihan(); void insert_jadwal(); void hapus_jadwal(); void tampilkan_jadwal(); struct node { int kode; char matkul [40];

#include

#include

#include

#include

using namespace std;

int pilih; void pilihan();

void insert_jadwal();

void hapus_jadwal();

void tampilkan_jadwal();

struct node

{

int kode;

char matkul [40];

int tanggal;

int jam;

int ruang;

node *prev, *next;

};

node *baru, *head=NULL, *tail=NULL,*help,*del;

main()

{

do

{

system("cls");

cout<<"JADWAL UJIAN"<

cout<<"=========================="<

cout<<"1. Tambah Jadwal"<

cout<<"2. Hapus Jadwal"<

cout<<"3. Tampilkan Jadwal"<

cout<<"4. Keluar"<

cout<<"Pilih menu (1 - 4) : ";

cin>>pilih;

cout<

pilihan();

cout<<"==============================="<

}

while(pilih!=4);

}

void pilihan()

{

if(pilih==1)

insert_jadwal();

else if(pilih==2)

hapus_jadwal();

else if(pilih==3)

tampilkan_jadwal();

else

{

cout<<"EXIT";

cout<<" Bye..."<

}

}

void buat_baru()

{

baru = new(node);

cout<<"Masukkan kode Matkul [5]: ";cin>>baru->kode;

cout<<"Masukkan Matkul [8-40]: ";cin>>baru->matkul;

cout<<"Masukkan tanggal [1-30]: ";cin>>baru->tanggal;

cout<<"Masukkan jam [8-17]: ";cin>>baru->jam;

cout<<"Masukkan ruang [3]: ";cin>>baru->ruang;

cout<<" \tJadwal telah ditambahkan";

cout<<" PRESS ENTER TO CONTINUE...";

getch();

baru->prev=NULL;

baru->next=NULL;

}

void insert_jadwal()

{

buat_baru();

if(head==NULL)

{

head=baru;

tail=baru;

}

else

{

baru->next=head;

head->prev=baru;

head=baru;

}

cout<

}

void hapus_jadwal()

{

int hapus;

int kode;

if(head==NULL)

{

cout<<" Linked List kosong, Penghapusan tidak dapat dilakukan"<

}

else

{

hapus=head->kode;

cout<<" Data yang dihapus adalah ";

cin>>kode;

del = head;

head = head->next;

delete del;

}

}

void tampilkan_jadwal()

{

if (head==NULL)

cout<<" Data tidak dapat ditemukan!"<

else

{

cout<<"JADWAL UJIAN BULAN INI"<

cout<<"-----------------------------------------------------------------------------"<

cout<<"Kode matkul-----Matkul------------------Tanggal---------Jam-------------Ruang"<

cout<<"-----------------------------------------------------------------------------"<

help=head;

while(help!=NULL)

{

cout<kode;

cout<<"\t\t"<matkul;

cout<<"\t\t\t"<tanggal;

cout<<"\t\t"<jam;

cout<<"\t\t"<ruang<

help=help->next;

}

}

getch();

}

i need to print void tampilkan_jadwal() with int tanggal; sorted ascending

sorry bad english

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions