static void Main()
    {
        Console.WriteLine("Enter the string : ");
        stack  s = new stack();
        string check;

        check = Console.ReadLine();
        int size = 0;

        foreach (char c in check)
        {
            s.push(c);
            size++;
        }
        foreach (char c in check)
        {
            // cout<<s.top()<<endl;
            if (c != s.top())
            {
                break;
            }
            s.pop();
            size--;
        }

        if (size > 0)
        {
            Console.WriteLine("This is not Palindrome");
        }
        else
        {
            Console.WriteLine("this is Palindrome");
        }
    }
 public gsignalStack(stack stack = default, System.UIntPtr stackguard0 = default, System.UIntPtr stackguard1 = default, System.UIntPtr stktopsp = default)
 {
     this.stack       = stack;
     this.stackguard0 = stackguard0;
     this.stackguard1 = stackguard1;
     this.stktopsp    = stktopsp;
 }
Esempio n. 3
0
        /* prints element and NGE pair for
        *  all elements of arr[] of size n */
        public static void printNGE(int[] arr, int n)
        {
            int   i = 0;
            stack s = new stack();

            s.top = -1;
            int element, next;

            /* push the first element to stack */
            s.push(arr[0]);

            // iterate for rest of the elements
            for (i = 1; i < n; i++)
            {
                next = arr[i];

                if (s.Empty == false)
                {
                    // if stack is not empty, then
                    // pop an element from stack
                    element = s.pop();

                    /* If the popped element is smaller than
                     * next, then a) print the pair b) keep
                     * popping while elements are smaller and
                     * stack is not empty */
                    while (element < next)
                    {
                        Console.WriteLine(element + " --> "
                                          + next);
                        if (s.Empty == true)
                        {
                            break;
                        }
                        element = s.pop();
                    }

                    /* If element is greater than next, then
                     * push the element back */
                    if (element > next)
                    {
                        s.push(element);
                    }
                }

                /* push next to stack so that we can find next
                 * greater for it */
                s.push(next);
            }

            /* After iterating over the loop, the remaining
             * elements in stack do not have the next greater
             * element, so print -1 for them */
            while (s.Empty == false)
            {
                element = s.pop();
                next    = -1;
                Console.WriteLine(element + " -- " + next);
            }
        }
Esempio n. 4
0
 public trees(int size, string root)
 {
     length = size;
     nodes  = new node[size];
     stacks = new stack(size);
     roots  = add(root);
 }
Esempio n. 5
0
        public void EmptyStack()
        {
            stack  test    = new stack();
            object testing = test.isEmpty();

            Assert.Equal(false, testing);
        }
Esempio n. 6
0
        public void PushtoStack()
        {
            stack test = new stack();

            test.Push(5);
            Assert.Equal(5, test.Top.Value);
        }
Esempio n. 7
0
        static void Main(string[] args)
        {
            stack b = new stack();

            b.push(new customer("ofir", "levi", 1234.5));
            b.push(new customer("ron", "buch", 45679.5));
            b.push(new customer("tomer", "lerner", 9513.45));
            b.push(new customer("hai", "eliasy", 7456.2));
            b.push(new customer("yaakov", "ellyhasov", 5613.5));
            b.show();
            b.Peek();
            b.Pop();
            Console.WriteLine("******************\none customer has been deleted\n******************");
            b.show();
            b.Pop();
            Console.WriteLine("******************\none customer has been deleted\n******************");
            b.show();
            b.Pop();
            Console.WriteLine("******************\none customer has been deleted\n******************");
            b.show();
            b.Pop();
            Console.WriteLine("******************\none customer has been deleted\n******************");
            b.show();
            b.Pop();
            Console.WriteLine("******************\none customer has been deleted\n******************");
            b.show();
            b.Pop();
            b.show();
        }
Esempio n. 8
0
 public adjustinfo(stack old = default, System.UIntPtr delta = default, pcvalueCache cache = default, System.UIntPtr sghi = default)
 {
     this.old   = old;
     this.delta = delta;
     this.cache = cache;
     this.sghi  = sghi;
 }
Esempio n. 9
0
 private static void s_pop(stack s)
 {
     if (s_empty(s))
     {
         Py_FatalError("s_pop: parser stack underflow -- FATAL");
     }
     s.s_top.inc();
 }
Esempio n. 10
0
 public stackTest()//stack list)
 {
     testList = new Restaurant.stack();
     testAdd();
     testDebug();
     testDelete();
     testDebug();
 }
Esempio n. 11
0
        public void CanPushToStack()
        {
            stack bagels = new stack();

            bagels.push(3);

            Assert.Equal(3, bagels.Top.Value);
        }
Esempio n. 12
0
        public void MultiplePush()
        {
            stack test = new stack();

            test.Push(5);
            test.Push(4);
            test.Push(3);
            Assert.Equal(3, test.Top.Value);
        }
Esempio n. 13
0
        public void CanPeekNextValueStack()
        {
            stack cake = new stack();

            cake.push(2);
            cake.push(3);

            Assert.Equal(3, cake.peek());
        }
Esempio n. 14
0
        public void TestPeek()
        {
            stack S3 = new stack(10);

            S3.Push(1);
            S3.Push(2);
            S3.Push(3);
            Assert.AreEqual(3, S3.Peek());
        }
Esempio n. 15
0
        public void TestPush()
        {
            stack s = new stack(10);

            s.push(3);
            s.push(5);
            s.push(7);
            Assert.AreEqual(3, s.count());
        }
Esempio n. 16
0
        public void TestPush()
        {
            stack S1 = new stack(15);

            S1.Push(1);
            S1.Push(2);
            S1.Push(3);
            Assert.AreEqual(3, S1.Count());
        }
Esempio n. 17
0
        public void CanPushToMultipleThingsStack()
        {
            stack sticks = new stack();

            sticks.push(2);
            sticks.push(4);

            Assert.Equal(4, sticks.Top.Value);
        }
Esempio n. 18
0
        public void CanPopOffStack()
        {
            stack videogames = new stack();

            videogames.push(2);
            videogames.push(3);
            videogames.pop();

            Assert.Equal(2, videogames.Top.Value);
        }
Esempio n. 19
0
        public void TestPop()
        {
            stack s = new stack(10);

            s.push(3);
            s.push(5);
            s.push(7);
            Assert.AreEqual(7, s.pop());
            Assert.AreEqual(5, s.pop());
        }
Esempio n. 20
0
        public stack Reverse(stack input)
        {
            stack temp = new stack(input.StackSize);

            while (input.top >= 0)
            {
                temp.Push(input.Pop());
            }
            return(temp);
        }
Esempio n. 21
0
        public void TestClear()
        {
            stack s = new stack(10);

            s.push(3);
            s.push(5);
            s.push(7);
            s.clear();
            Assert.AreEqual(0, s.count());
        }
Esempio n. 22
0
        public void TestPop()
        {
            stack S2 = new stack(15);

            S2.Push(1);
            Assert.AreEqual(1, S2.Pop());

            S2.Push(2);
            Assert.AreEqual(2, S2.Pop());
        }
Esempio n. 23
0
        public void PopOffStack()
        {
            stack test = new stack();

            test.Push(4);
            test.Push(3);
            test.Push(2);
            object popOff = test.Pop();

            Assert.NotEqual(3, popOff);
        }
Esempio n. 24
0
 void Start()
 {
     _bulletStartPos = _bullet.transform.position;
     _state = State.main;
     letter.SetActive(false);
     Camera cam = Camera.main;
     screenHeight = 2f * cam.orthographicSize;
     screenWidth = screenHeight * cam.aspect;
     _stackScript = stack.GetComponent<stack>();
     letter.SetActive(false);
 }
Esempio n. 25
0
        public void CanEmptyStacksWithPops()
        {
            stack crayons = new stack();

            crayons.push(5);
            crayons.push(4);
            crayons.pop();
            crayons.pop();

            Assert.Null(crayons.Top);
        }
Esempio n. 26
0
        public void Peek()
        {
            stack test = new stack();

            test.Push(5);
            test.Push(4);
            test.Push(3);
            object peeking = test.Peek();

            Assert.Equal(3, peeking);
        }
Esempio n. 27
0
        public void TestCount()
        {
            stack S4 = new stack(7);

            S4.Push(1);
            S4.Push(2);
            S4.Push(3);
            S4.Push(4);
            S4.Push(5);
            S4.Push(6);
            Assert.AreEqual(6, S4.Count());
        }
Esempio n. 28
0
        public void EmptyTheStackAfterMultiplePops()
        {
            stack test = new stack();

            test.Push(5);
            test.Push(4);
            test.Push(3);
            object popOff  = test.Pop();
            object popOff2 = test.Pop();

            Assert.NotEqual(3, popOff);
        }
Esempio n. 29
0
    // Driver program to test above methods
    public static void main(String[] args)
    {
        stack s = new stack();

        s.push(10);
        s.push(20);
        System.out.println("Top element :" + s.top());
        s.pop();
        s.push(30);
        s.pop();
        System.out.println("Top element :" + s.top());
    }
        static void Main(string[] args)
        {
            var stack = new stack();

            stack.Push(1);
            stack.Push(2);
            stack.Push(3);

            System.Console.WriteLine(stack.Pop());
            System.Console.WriteLine(stack.Pop());
            System.Console.WriteLine(stack.Pop());
        }
Esempio n. 31
0
        private static int shift(stack s, int type, CharPtr str, int newstate, int lineno)
        {
            int err;

            assert(!s_empty(s));
            err = PyNode_AddChild(s.s_top[0].s_parent, type, str, lineno);
            if (0 != err)
            {
                return(err);
            }
            s.s_top[0].s_state = newstate;
            return(0);
        }
        public void NumToLinkedList(int number)
        {
            stack<int> st = new stack<int>();
            while (number != 0)
            {
                int reminder = number % 10;
                st.push(reminder);
                number =number/10;
            }

            while (st.length != 0)
            {
                lnk.Add(new node<int>(st.pop()));
            }
        }
        public void NumToString(int num)
        {
            string[] strDigit = {"zero" ,"one", "two", "Three", "Five", "Six", "Seven", "Eight", "Nine"};

            int digit;
            stack<string> stc = new stack<string>();

            while (num!=0)
            {
                digit = num % 10;
                num = num / 10;
                stc.push(strDigit[digit]);
            }

            while (! (stc.length == 0))
            {
                Console.Write("{0} ", stc.pop());
            }
        }
Esempio n. 34
0
 // Use this for initialization
 void Start()
 {
     _stackScript = _stack.GetComponent<stack>();
     Anim = GetComponent<Animator>();
 }
Esempio n. 35
0
 public QueueWith2Stack()
 {
     inbox = new stack<int>();
     outbox = new stack<int>();
 }