Пример #1
0
        /// <summary>
        /// This is the main program.
        /// </summary>
        ///
        static void Main()
        {
            int problemNumber;

            // ProblemFactory problemFactory = new ProblemFactory();
            totalTime = new Stopwatch();

            problemNumber = GetUserInput();

            while (problemNumber > 0)
            {
                totalTime.Reset();
                totalTime.Start();
                string result = ProblemFactory.GetSolution(problemNumber).Compute();
                totalTime.Stop();

                Console.WriteLine("\n-----------------------------------------------------------------------");
                Console.WriteLine("Solution to problem " + problemNumber + " = " + result);
                Console.WriteLine("Execution time was " + Utilities.FormatMilliseconds(totalTime.ElapsedMilliseconds));
                Console.WriteLine("-----------------------------------------------------------------------");
                Console.WriteLine();
                problemNumber = GetUserInput();
            }

            Console.WriteLine("Goodbye. Press any key to continue");
            Console.ReadKey();
        }