Page 78 - C++
P. 78
Ans. void CQUEUE : : Ins_Player( )
{
if((Front==0 && Rear==size-1) || (Front==Rear+1)
{
cout<< “Overflow”;
return;
}
else if(Rear = = -1)
{
Front=0;
Rear=0;
}
else if(Rear= =size-1)
{
Rear=0;
}
else
{
Rear++;
}
cout<< “Enter Player Id=”;
cin>>Ar[Rear].Pid;
cout<< “Enter Player Name=”;
gets(Ar[Rear].Pname);
}
OR
struct Book
{
int BNo;
char BName[20];
Book *Next;
}*temp,*top;
void pop()
{
temp=new Book ;
temp=top;
top=top->next;
delete temp;
}
(1 Mark for checking if Queue is Full)
(1 Mark for checking if Queue is Empty)
(½ Mark for checking Rear is at size-1)
(½ Mark for incrementing Rear)
(½ Mark for assigning Values to the Rear location of the Queue)
14