Page 329 - C++
P. 329

(e)     Convert  the  following  Infix  expression  to  its  equivalent  Postfix
                   expression,  showing  the  stack  contents  for  each  step  of
                   conversion :                                                                    2

                           U * V + (W – Z) / X




      4.   (a)     A text file named MATTER.TXT contains some text, which needs to
                   be displayed such that every next character is separated by a symbol
                   ‘#’.
                   Write  a  function  definition  for  HashDisplay()  in  C++  that  would
                   display  the  entire  content  of  the  file  MATTER.TXT  in  the  desired
                   format.                                                                         3

                   Example :
                   If the file MATTER.TXT has the following content stored in it :
                   THE WORLD IS ROUND

                   The function HashDisplay() should display the following content :
                   T#H#E# #W#O#R#L#D# #I#S# #R#O#U#N#D#




           (b)     Write a definition for a function TotalTeachers( ) in C++ to read each
                   object  of  a  binary  file  SCHOOLS.DAT,  find  the  total  number  of
                   teachers,  whose  data  is  stored  in  the  file  and  display  the  same.
                   Assume  that  the  file  SCHOOLS.DAT  is  created  with  the  help  of
                   objects of class SCHOOLS, which is defined below :                              2
                   class SCHOOLS
                   {
                       int SCode;                //School Code
                       char SName[20];   //School Name
                       int NOT;                  //Number of Teachers in the school

                   public:

                       void Display()
                       {cout<<SCode<<"#"<<SName<<"#"<<NOT<<endl;}
                       int RNOT(){return NOT;}
                   };


      91                                            10
   324   325   326   327   328   329   330   331   332   333   334