Sponsor Area
Data Structure
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;
}
}
Some More Questions From Data Structure Chapter
Write the definition of a member function Pop() in C++, to delete a book from a dynamic stack of TEXTBOOKS considering the following code is already included in the program.
struct TEXTBOOKS
{
char ISBN[20]; char TITLE[80];
TEXTBOOKS *Link;
};
class STACK
{
TEXTBOOKS *Top;
public:
STACK(){Top=NULL;}
void Push();
void Pop();
~STACK();
};
struct TEXTBOOKS
{
char ISBN[20]; char TITLE[80];
TEXTBOOKS *Link;
};
class STACK
{
TEXTBOOKS *Top;
public:
STACK(){Top=NULL;}
void Push();
void Pop();
~STACK();
};Write a function REVCOL (int P[] [5], int N, int M) in C++ to display the content of a two-dimensional array, with each column content in reverse order.
Note: Array may contain any number of rows.
For example, if the content of the array is as follows:
15
12
56
45
51
13
91
92
87
63
11
23
61
46
81
The function should display output as:
11
23
61
46
81
13
91
92
87
63
15
12
56
45
51
Write a function ALTERNATE (int A[][3],int N,int M) in C++ to display all alternate element from two-dimensional array A (starting from A[0][0]).
For example:
If the array is containing:
23
54
76
37
19
28
62
13
19
The output will be:
23
76
19
62
19
For example:
If the array is containing:
Sponsor Area
Mock Test Series
Mock Test Series



