void BarisGilir::hapusQ()
{
int Nilai;
nodeQ *hapusNod, *temp = kepala;
if (kosong())
cout << "\nTiada data dalam senarai\n";
else
{
//queue tidak kosong
Nilai = kepala->data;
temp = kepala;
kepala = kepala->next;
delete(temp); // hapus nod
//jika hapus baris gilir yang ada satu nod
if (!kepala)
ekor = NULL;
}
}
if (kosong())
cout << "\nPenghapusan tidak dapat dilaksanakan";
else
{
//queue tidak kosong
Nilai = kepala->data;
temp = kepala;
kepala = kepala->next;
delete(temp); // hapus nod
//jika hapus baris gilir yang ada satu nod
if (!kepala)
ekor = NULL;
}
}
It may just be me, but this looks an awful lot like the code in a question earlier this week.
I will need to ask you the same as that person:
1. Please describe the problem clearly. Asking us "is something wrong" is kind of redundant, you know something is wrong and presumably you get an error or a function doesn't work as you want it to - please tell us.
2. Please put your code in [code ]{code here}[/code] blocks so it will have syntax highlighting - much easier to read.
3. Please use code indentation, again for readability: http://en.wikipedia.org/wiki/Programming_style#Indentation
Also, please tell us what this program is supposed to be doing as you have written it in your own language, which most of use here won't understand.