Esempio n. 1
0
        //////////////////////////////////////////////////////////////////////////
        public static void class_interaction_difference()
        {
            Stack_cl p_        = new Stack_cl();
            Stack    newst     = p_.st;
            int      sizestack = 0;

            foreach (Object obj in p_.st)
            {
                sizestack += 1;
            }
            int max = sizestack;

            sizestack = 0;
            string str_ = "";
            string del_ = "";

            foreach (Object obj in p_.st)
            {
                sizestack += 1;
                if (sizestack == 1)
                {
                    str_ += p_.st;
                    del_ += p_.st;
                }
                if (sizestack == max)
                {
                    str_ = str_.Replace(del_, "");
                }
            }
            Console.WriteLine("Sum Stack: " + str_);
        }
Esempio n. 2
0
        //////////////////////////////////////////////////////////////////////////
        public static void class_interaction_Sum()
        {
            Stack_cl p_ = new Stack_cl();

            if (p_.st.Count == 0 || p_.st.Count <= 0)
            {
                Console.WriteLine("Stack is empty");
            }
            else
            {
                Stack newst     = p_.st;
                int   sizestack = 0;
                foreach (Object obj in p_.st)
                {
                    sizestack += 1;
                }
                int    max  = sizestack;
                string str_ = "";
                sizestack = 0;
                foreach (Object obj in p_.st)
                {
                    sizestack += 1;
                    if (sizestack == 1 || sizestack == max)
                    {
                        str_ += p_.st;
                    }
                }
                Console.WriteLine("Sum Stack: " + str_);
            }
        }
Esempio n. 3
0
        //////////////////////////////////////////////////////////////////////////
        public static Stack_cl operator +(Stack_cl st1, string val)
        {
            Stack_cl st_ = new Stack_cl();

            st_.st.Push(val);
            return(st_);
        }
Esempio n. 4
0
        //////////////////////////////////////////////////////////////////////////
        public static Stack_cl operator -(Stack_cl st1, string val)
        {
            Stack_cl st_ = new Stack_cl();

            st_.st.Pop();
            IEnumerable myCollection = st_.st;
            Object      obj          = myCollection;

            Console.WriteLine("Value Stack: " + obj);
            return(st_);
        }
Esempio n. 5
0
        //////////////////////////////////////////////////////////////////////////
        public static void class_interaction_number_element()
        {
            Stack_cl p_        = new Stack_cl();
            Stack    newst     = p_.st;
            int      sizestack = 0;

            foreach (Object obj in p_.st)
            {
                sizestack += 1;
            }
            Console.WriteLine("Number Stack: " + sizestack);
        }
Esempio n. 6
0
        static void Main(string[] args)
        {
            //название переменной + переменная содрежащая данные
            Stack_cl st_m = new Stack_cl();
            bool     x    = true;

            Console.WriteLine("Enter new value: ");
            string str = Console.ReadLine();

            st_m += str;

            st_m    -= str;
            st_m.bl &= x;
        }
Esempio n. 7
0
        //////////////////////////////////////////////////////////////////////////
        public static bool operator &(Stack_cl st1, int x = 0)
        {
            Stack_cl newst = new Stack_cl();

            if (newst.st.Count == 0 || newst.st.Count <= 0)
            {
                newst.bl = false;
            }
            else
            {
                newst.bl = true;
            }
            return(newst.bl);
        }