コード例 #1
0
        static void RunBisect()
        {
            bool tryagain = false;

            do
            {
                BisectInput input = new BisectInput();
                input.UserInputNumber();
                Bisection b       = new Bisection();
                int[]     myArray = b.Algorithm;
                int       num     = input.userNum;
                b.BisectionMethod(myArray, num);

                WriteText.WriteLine("Would you like to try another number? type \"yes\" or \"no\"");
                string YesOrNo = Convert.ToString(Console.ReadLine());
                if (YesOrNo.ToLower() == "yes")
                {
                    Console.Clear();
                    tryagain = true;
                }
                else if (YesOrNo.ToLower() == "no")
                {
                    tryagain = false;
                }
                else
                {
                    WriteText.WriteLine("Invalid Entry defaulting as yes, please next time enter yes or no");
                    Console.ReadLine();
                    Console.Clear();
                    tryagain = true;
                }
            } while (tryagain == true);
            Console.ReadKey(true);
            menu.Show();
        }
コード例 #2
0
        static void Main(string[] args)
        {
            var bisect = new Bisection();

            bisect.Run();

            var userGuess = new GuessNumber();

            userGuess.Run(new Bounds(1, 1001));

            var userSelect = new SelectNumber();

            userSelect.Run(new Bounds(1, 101));
        }