static void Main(string[] args)
        {
            //IStos<string> s = new StosWTablicy<string>(2);
            //s.Push("km");
            //s.Push("aa");
            //s.Push("xx");
            //foreach (var x in s.ToArray())
            //    Console.WriteLine(x);
            //Console.WriteLine();

            //foreach (var item in ((StosWTablicy<string>)s).TopToBottom)
            //    Console.WriteLine(item);
            //Console.WriteLine();

            IStos <int> stos = new StosWTablicy <int>(2);

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

            foreach (var item in stos.ToArray())
            {
                Console.WriteLine(item);
            }

            Console.WriteLine();

            foreach (var item in ((StosWTablicy <int>)stos).ToArrayReadOnly())
            {
                Console.WriteLine(item);
            }

            Console.ReadKey();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            StosWTablicy <string> s = new StosWTablicy <string>();

            s.Push("km");
            s.Push("aa");
            s.Push("ab");


            foreach (var x in s.ToArray())
            {
                Console.WriteLine(x);
            }


            foreach (var x in ((StosWTablicy <string>)s).Revert)
            {
                Console.WriteLine(x);
            }

            Console.WriteLine($"Długość: {s.Length()}");
            s.TrimExcess();
            Console.WriteLine($"Przycięty: {s.Length()}");
            Console.WriteLine($"Pierwszy element: {s[0]}");
            Console.WriteLine($"Ostatni element: {s[2]}");
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            StosWTablicy <string> s = new StosWTablicy <string>(3);

            s.Push("km");
            s.Push("aa");
            s.Push("xx");
            s.Push("xx");

            StosWLiscie <string> s2 = new StosWLiscie <string>();

            s.Push("km");
            s.Push("aa");
            s.Push("xx");
            s.Push("xx");

            Console.WriteLine(s2.IsEmpty());
            Console.WriteLine(s[1]);

            foreach (var x in s.ToArrayReadOnly())
            {
                Console.WriteLine(x);
            }

            foreach (var x in s.ToArray())
            {
                Console.WriteLine(x);
            }
            s.TrimExcess();
            Console.WriteLine();
            //foreach (var item in s)
            //{
            //    Console.WriteLine(item);
            //}
        }
 static void Main(string[] args)
 {
     StosWTablicy<string> s = new StosWTablicy<string>(2);
     s.Push("km");
     s.Push("aa");
     s.Push("xx");
     foreach (var x in s.ToArray())
     {
         Console.WriteLine(x);
     }
     Console.WriteLine();
 }
Beispiel #5
0
 internal StackEnum(StosWTablicy <T> stack)
 {
     this.stack = stack;
 }
 public Enumerator(StosWTablicy <T> s, bool toBottom = false)
 {
     this.stos     = s;
     this.toBottom = toBottom;
 }
 internal Enumerator(StosWTablicy <T> stos) => this.stos = stos;
 public StosIEnumerator(StosWTablicy <T> stos)
 {
     this._stos = stos;
 }