Code is copied!
Holder is a kind of data structure which can store elements with the restriction that an element can be added from the rear end and removed from the front end only.
The details of the class Holder is given below:
Class name : Holder
Data members/instance variables:
Q[ ] : array to hold integers
cap : maximum capacity of the holder
front : to point the index of the front end
rear : to point the index of the rear end
Methods / Member functions:
Holder(int n ) : constructor to initialize cap=n, front= 0 and rear=0
void addint( int v ) : to add integers in the holder at the rear end if
possible, otherwise display the message “ HOLDER IS FULL ”
int removeint( ) : removes and returns the integers from the front end of the holder if any, else returns −999
void show( ) : displays the elements of the holder
Specify the class Holder giving details of the functions void addint(int) and int
removeint( ). Assume that the other functions have been defined.
The main( ) function and algorithm need NOT be written
Solution:
,,,
undefined