MENU
Question -

Write a function PUSHBOOK() in C++ to perform insert operation on Dynamic Stack, which contains Book_no and Book_Title. Consider the following definition of NODE, while writing your C+ + code,

struct NODE
{
int Book_No ;
char Book_Title [20];
NODE * Next;
};



Answer -

Void PUSHBOOK (NODE *TOP> int Book_No, char B Title [20])
 {
 NODE*temp;
 temp=new NODE;
 temp —> Book_No=Book_No;
 Strcpy (temp —> Book_Title, B Title) ;
 temp --> Next=NULL ;
 if (Top==NULL)
 Top=temp;
 else
 {
 temp —> Next=top;
 Top==temp;
 }
 }

Comment(S)

Show all Coment

Leave a Comment

Free - Previous Years Question Papers
Any questions? Ask us!
×