Write the definition of a member function ADDMEM() for a class QUEUE in C++, to add a MEMBER in a dynamically allocated Queue of Members considering the following code is already written as a part of the program.
struct Member
{
int MNO;
char MNAME[20];
Member *Next;
};
class QUEUE
{
Member *Rear,*Front;
public:
QUEUE(){Rear=NULL;Front=NULL;}
void ADDMEM();
void REMOVEMEM();
~QUEUE();
};
void QUEUE::ADDMEM()
{
Member *T;
T=new Member;
cin>>T->MNO;
gets(T->MNAME);
T->Next=NULL;
if (Rear==NULL)
{
Rear=T;Front=T;
}
else
{
Rear->Next=T;
Rear=T;
}
}