Пример #1
0
        static void Main(string[] args)
        {
            //create list and add to it
            MyList list = new MyList();

            list.AddToEnd(9);
            list.AddToEnd(2);
            list.AddToBeginning(3);
            list.AddToEnd(6);
            list.Print();
            Console.ReadLine();
        }
Пример #2
0
        static void Main(string[] args)
        {
            MyList list = new MyList();

            list.AddToEnd(9);
            list.AddToEnd(5);
            list.AddToEnd(11);
            list.AddToEnd(4);
            list.AddToBeginning(9);
            list.AddToBeginning(5);
            list.AddToBeginning(11);
            list.AddToBeginning(4);
            list.AddSorted(9);
            list.AddSorted(5);
            list.AddSorted(11);
            list.AddSorted(4);
            list.Print();
        }
Пример #3
0
        static void Main(string[] args)
        {
            MyList list = new MyList();
            list.AddToEnd(10);
            list.AddToEnd(13);
            list.AddToEnd(50);
            list.AddToEnd(67);
            list.AddToEnd(33);
            list.AddToEnd(19);
            list.Print();

        }
        static void Main(string[] args)
        {
            MyList list         = new MyList();
            MyList temp         = new MyList();
            MyList tempReversed = new MyList();

            string[] names = new string[]
            {
                "Hasan Minhaj",
                "Nick Jonas",
                "Priyanka Chopra",
                "Angelina Jolie",
                "Varun Dhawan",
                "Zayn Malik",
                "Taylor Swift",
                "Shahrukh Khan",
                "Selena Gomez",
                "Kim Kardashian",
                "Salman Khan",
                "Sonam Kapoor",
                "Kevin Hart",
                "Amitabh Bachchan",
                "Kanye West"
            };

            for (var i = 0; i < names.Length; i++)
            {
                list.AddToEnd(names[i]);
            }
            Console.WriteLine("Hi, Welcome to Tina’s Planning! Here are a few options for the seating arrangement for your event!");
            Console.WriteLine();
            list.Print();
            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine("Type the name from the list above following proper letter case who would you like to seat first? ");
            do
            {
                string userInput = Console.ReadLine();
                //validate input
                if (userInput == "")
                {
                    Console.WriteLine("Input cannot be blank");
                }
                else
                {
                    if (userInput != "finish")
                    {
                        temp.AddToBeginning(userInput);
                        tempReversed.AddToEnd(userInput);
                        list.DeleteNode(userInput);
                        Console.WriteLine();
                        Console.WriteLine("Ok, here’s the new arrangement: ");
                        tempReversed.Print();
                        Console.Write(", ");
                        list.Print();
                        Console.WriteLine();
                        Console.WriteLine();
                        Console.WriteLine("Who would you like to seat next? ");
                    }
                    else
                    {
                        Console.WriteLine("");
                        Console.WriteLine("Great! Here is the final seating arrangement: ");
                        list.ConsolidatedList(temp, list, tempReversed);
                        list.Print();
                        Console.WriteLine();
                        Console.WriteLine("The End");
                    }
                }
            }while (true);
        }