コード例 #1
0
        public override bool Equals(object obj)
        {
            Pancake pan = obj as Pancake;

            if (pan == null)
            {
                return(false);
            }
            else
            {
                return(sideUp.Equals(pan.sideUp));
            }
        }
コード例 #2
0
        public static void stackPancakes(String pancakeStack)
        {
            Stack   temp = new Stack();
            Pancake pan;

            var pancakes = pancakeStack.ToCharArray();

            foreach (char p in pancakes)
            {
                temp.Push(p);
            }
            while (temp.Count > 0)
            {
                pan = new Pancake((char)temp.Pop());
                st.Push(pan);
            }
        }