error in queue circular using link list

this is the code...

#include <iostream.h>
#include <stdlib.h>
#include <conio.h>

// Queue implementation link list


struct nodeQ
{
char items;
nodeQ * next;
}; 

class queue
{
private:
int count, front, back;
char items[];

public:
queue(); // Constructor - create Q
~queue(); // Destructor - destroy Q
bool isEmpty(); // check Q empty
bool isFull(); // check Q full
void enQueue(char); // insert into Q
void deQueue(); // remove item from Q
char getFront(); // get item at Front
char getRear(); // get item at back Q
nodeQ *backPtr, * frontPtr, *newPtr; // declaration for back and front pointer
};

// Write source codes for the following fucntions

// code queue(); // Constructor - create Q
queue::queue()
{
count=0;
front=0;

}
// code ~queue(); // Destructor - destroy Q
queue::~queue()
{
delete []items;
}
// code isEmpty(); // check Q empty
bool queue::isEmpty()
{
return bool(count==0);
}
// code isFull(); // check Q full
bool queue::isFull()
{ 
return bool(count==);
}
// code enQueue(char); // insert into Q
void queue::enQueue(char )
{
if (isFull())
cout<< "\nCannot Insert. Queue is full!";
else
{
newPtr->next=backPtr->next;
backPtr->next=newPtr;
backPtr=newPtr;
++count;
}
}
// code deQueue(); // remove item from Q
void queue::deQueue()
{
if (isEmpty())
{
backPtr=NULL;
delete frontPtr;
}
else
{
frontPtr=backPtr->next;
backPtr->next=frontPtr->next;
delete frontPtr;
}
}
// code getFront(); // get item at Front
char queue::getFront()
{
return items[front];
}
// code getRear(); // get item at back Q
char queue::getRear()
{
return items[back];
}

// main program
main()
{ queue myQueue;
myQueue.enQueue('A');
myQueue.enQueue('B');
myQueue.enQueue('C');
cout << "Item at front queue: " << myQueue.getFront();
cout << " Item at back queue : " << myQueue.getRear();
myQueue.deQueue(); // add code to print the value deleted from queue
myQueue.deQueue();
myQueue.deQueue();
myQueue.deQueue();
myQueue.enQueue('C');
myQueue.enQueue('D');
myQueue.deQueue();
myQueue.deQueue();
myQueue.enQueue('E');
getch();
// in forum, discuss is there any problem occur in link list implementation.
// compare with the implementation using linear array
// is the same problem occur.
// what is the advantage of using circular link list
}


can u all trace the errors and help me fix it????
i got headache to find the errors...!
ur help are so much thanks to me!
Last edited on
Topic archived. No new replies allowed.