Page 514 - Computer science 868 Class 12
P. 514

19       else
                20       {

                21       st[++r] = v; // insert from rear end
                22       }
                23       }

                24       int popvalue()

                25       {
                26       if (f == r) // underflow condition
                27       {

                28       return -9999;
                29       }

                30       else
                31       { f++; // deletion from front end

                32       return st[f];
                33       }

                34       }
                35       void disp( )

                36       {
                37       for (int i = f+1;i<=r; i ++)

                38       System.out.print(st[i]+" ");
                39       }

                40        public static void main(int s)
                41       {    Repeat ob=new Repeat(s);

                42            Scanner sc= new Scanner(System.in);
                43            int ch,n;

                44            do    //menu
                45            { System.out.println("1.Insert \n 2.Delete \n 3. Display \n Enter choice \n");

                46              ch=sc.nextInt();
                47              switch(ch)
                48              {case 1:

                49              System.out.println("Enter number to insert");

                50              n=sc.nextInt();
                51              ob.pushvalue(n);
                52              break;





                512512  Touchpad Computer Science-XII
   509   510   511   512   513   514   515   516   517   518   519