Page 130 - C++
P. 130

NOT          Pop True                    False
                                        Evaluate NOT(True)

                                        Push False                  False  False
                           OR           Pop False                   False
                                        Pop False                   #
                                        Evaluate False OR False
                                        Push False                  False

                           True         Push True                   False  True
                           False        Push False                  False True False
                           AND          Pop False                   False  True
                                        Pop True                    False

                                        Evaluate True AND False
                                        Push False                  False False
                           OR           Pop False                   False
                                        Pop False                   #
                                        Evaluate False OR False

                                        Push False                  False
                           ;            Pop and print False         #                  False


                       e) Write a function QDELETE() to perform delete operation on a linked queue
                       which contains rollno, name of a student. Consider the following definition of

                       node in the code. struct node                                                     4
                              {      int rollno;

                                     char name[20];

                                     node *link;
                              };

                       Ans: class queue
                              {
                                 node * rear, *front;
                              public:
                                     queue()
                                     {rear=front=NULL;     }

                                     void qadd();
                                     void qdelete();
                              };
                              void queue::qdelete()
                              {  if( front ==NULL)

                                    cout<<” queue is empty “;



               XII / Comp. Sc.                                                             Page 9 of 17
   125   126   127   128   129   130   131   132   133   134   135