コード例 #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            CerealList testList = generateListForTesting();

            // Print the list
            testList.PrintList();
            // Reverse the list
            ReverseLL(testList);
            // Print the list again, showing that it has been reversed
            testList.PrintList();
            Console.ReadKey();
        }
コード例 #2
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Hello World!"); CerealList GeneralMills = genListOne();
            CerealList Kellogs = genListTwo();

            Console.WriteLine("General Mills");
            GeneralMills.PrintList();
            Console.WriteLine("Kellogs");
            Kellogs.PrintList();
            Merge(GeneralMills, Kellogs);
            Console.WriteLine("Combined");
            GeneralMills.PrintList();
            Console.ReadKey();
        }
コード例 #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            CerealList MyCereal = CreateInitialList();

            Console.WriteLine("Here's a list of cereals!");
            MyCereal.PrintList();

            UserLoop(MyCereal);
        }
コード例 #4
0
        static void PerformAction(char pick, CerealList MyCereal)
        {
            Cereal newCer = null;
            string oldCer = null;

            Console.WriteLine("\n");
            switch (pick)
            {
            case '1':
                newCer = new Cereal(GetNewCereal());
                MyCereal.AddCereal(newCer);
                break;

            case '2':
                newCer = new Cereal(GetNewCereal());
                MyCereal.AppendCereal(newCer);
                break;

            case '3':
                newCer = new Cereal(GetNewCereal());
                Console.WriteLine("Which cereal should come after this new one?");
                oldCer = Console.ReadLine();
                MyCereal.AddBefore(newCer, oldCer);
                break;

            case '4':
                newCer = new Cereal(GetNewCereal());
                Console.WriteLine("Which cereal should come before this new one?");
                oldCer = Console.ReadLine();
                MyCereal.AddAfter(newCer, oldCer);
                break;

            case '5':
                MyCereal.PrintList();
                break;

            default:
                Console.WriteLine("Sorry, that wan't an option.");
                break;
            }
            UserLoop(MyCereal);
        }