Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            int option;
            NumberCollection nc = new NumberCollection();

            nc.Add(1);
            nc.Add(2);
            nc.Add(3);
            nc.Add(4);
            nc.Add(5);
            nc.Add(-5);

            do
            {
                Console.WriteLine("What would you like to do?");
                Console.WriteLine("1 - Sort the array");
                Console.WriteLine("2 - Multiply the array by 2");
                Console.WriteLine("3 - Exit");
                option = Int32.Parse(Console.ReadLine());

                if (option == 1)
                {
                    nc.Sort();
                }
                else if (option == 2)
                {
                    nc.Multiply();
                }

                Console.WriteLine(nc.ToString());
            } while (option != 3);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            NumberCollection collection = new NumberCollection();

            collection.Add(1);
            collection.Add(5);
            collection.Add(4);
            collection.Add(3);
            collection.Add(15);
            collection.Add(12);
            collection.Add(7);
            collection.Remove(7);
            collection.Remove(1);
            collection.Remove(5);
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            NumberCollection myCollection = new NumberCollection();

            for (int i = 1; i <= 12; i++)
            {
                myCollection.AddNumber(i);
                myCollection.Sort(myCollection.GetNumbers());
            }

            for (int i = 12; i >= 7; i--)
            {
                myCollection.RemoveNumber(i);
                myCollection.Sort(myCollection.GetNumbers());
            }
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            NumberCollection nc = new NumberCollection();

            nc.Add(1);
            nc.Add(2);
            nc.Add(3);
            nc.Add(4);
            nc.Add(5);
            nc.Add(6);
            nc.Add(7);
            nc.Add(8);
            nc.Add(9);

            nc.Sort();

            nc.Add(10);
            nc.Add(11);
            nc.Sort();
        }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            NumberCollection collection = new NumberCollection();

            collection.add(1);
            collection.sort();
            collection.add(2);
            collection.sort();
            collection.add(3);
            collection.sort();
            collection.add(4);
            collection.sort();
            collection.add(5);
            collection.sort();
            collection.remove(5);
            collection.sort();
            collection.remove(4);
            collection.sort();
            collection.remove(2);
            collection.sort();
        }
Ejemplo n.º 6
0
        static void Main(string[] args)
        {
            NumberCollection numberCollection = new NumberCollection();

            for (int i = 0; i < 1000; i++)
            {
                numberCollection.add(1);
                numberCollection.add(3);
                numberCollection.add(2);
            }
            numberCollection.sort();

            for (int i = 0; i < 1000; i++)
            {
                numberCollection.remove(1);
                numberCollection.remove(3);
                numberCollection.remove(2);
            }

            numberCollection.sort();
        }