Computer Science, asked by bubai9989, 13 hours ago

Write a function in C++ to perform insert operation on dynamically allocated queue containing names of students

Answers

Answered by r30499699
0

class Queue

{

NODE *front,*rear;

public:

Queue( )

{ front = rear = NULL; }

void Insert( );

void Delete( );

void Display( );

};

void Queue::Insert( )

{

NODE *ptr;

ptr=new NODE;

if(ptr= = NULL)

{

cout<<”\nNo memory to create a new node….”;

exit(1);

}

cout<<”\nEnter the name….”;

gets(ptr → Name);

ptr→ Link=NULL;

if(rear= = NULL)

front=rear=ptr;

else

{

rear→Link=ptr;

rear=ptr;

}

}

Similar questions