newNode = new node;
strcpy( newNode->ID, id );
strcpy( newNode->Position, position );
strcpy( newNode->TotalPages, pages );
newNode->next = NULL;
if (newNode){
// nod baru berjaya dicipta
if (empty())
//queue kosong
kepala=newNode;
else
//queue tidak kosong
ekor->next=newNode;
ekor=newNode;
}
else
//nod baru gagal dicipta
cout<<"\nTidak dimasukkan krn ingatan tidak mencukupi\n";
}
bool cetak::empty()
{
return (count==0);
}
void cetak::displayall()
{
struct node *nodePtr = head;
if (nodePtr == NULL)
cout << "The list is empty!\n";
else
{
while (nodePtr != NULL)
{
cout << nodePtr->ID << endl;
cout << nodePtr->Position << endl;
cout << nodePtr->TotalPages << endl;
nodePtr = nodePtr->next;
}
}
}
void menu(void)
{
cout <<" Masukkan Pilihan Anda:" << endl;
cout <<" 1 > Menambah item"<< endl;
cout <<" 2 > Membuang item"<< endl;
cout <<" 3 > Memaparkan item"<< endl;
cout <<" 4 > Keluar dari sistem"<< endl;
cout <<" Pilihan Anda ====> ";
}