示例#1
0
        private static NumberReader SetBoundariesToReader()
        {
            var boundaryReader = new NumberReader(int.MinValue, int.MaxValue);
            Console.Write("Define min allowed number: ");
            int min = boundaryReader.ReadNumberFromConsole();
            Console.Write("Max allowed number: ");
            int max = boundaryReader.ReadNumberFromConsole();

            while (min + NumLoops >= max)
            {
                Console.WriteLine("\nMax number should be greater than {0}. Try again.", min + NumLoops);
                Console.Write("\nMax allowed number: ");
                max = boundaryReader.ReadNumberFromConsole();
            }

            return new NumberReader(min, max, NumLoops);
        }
示例#2
0
        private static NumberReader SetBoundariesToReader()
        {
            var boundaryReader = new NumberReader(int.MinValue, int.MaxValue);

            Console.Write("Define min allowed number: ");
            int min = boundaryReader.ReadNumberFromConsole();

            Console.Write("Max allowed number: ");
            int max = boundaryReader.ReadNumberFromConsole();

            while (min + NumLoops >= max)
            {
                Console.WriteLine("\nMax number should be greater than {0}. Try again.", min + NumLoops);
                Console.Write("\nMax allowed number: ");
                max = boundaryReader.ReadNumberFromConsole();
            }

            return(new NumberReader(min, max, NumLoops));
        }