예제 #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Choose, what you want to do:");
            Console.WriteLine("Multiply matrixes (type 1) or solve equation (type 2)");
            string matrixOrEquation;

            do
            {
                Console.WriteLine("Make correct choice");
                matrixOrEquation = Console.ReadLine();
            } while (matrixOrEquation != "1" && matrixOrEquation != "2");
            if (matrixOrEquation == "2")
            {
                Console.WriteLine("Choose, what equation you want to solve.");
                Console.WriteLine("For linear type 1, for quadratic type 2.");
                string type;
                string path = ResourceData.path;
                do
                {
                    Console.WriteLine("Make correct choice");
                    type = Console.ReadLine();
                } while (type != "1" && type != "2");
                if (type == "1")
                {
                    Linear linear = CreateLinear(path);
                    linear.FindSolution();
                    Logger logger = new Logger(path);
                    logger.Log(linear);
                }
                if (type == "2")
                {
                    Quadratic quadratic = CreateQuadratic(path);
                    quadratic.FindSolution();
                    Logger logger = new Logger(path);
                    logger.Log(quadratic);
                }
                Console.WriteLine("Check log file. Press any key to exit.");
            }
            if (matrixOrEquation == "1")
            {
                string path   = ConfigurationManager.AppSettings["pathToMatrix"];
                Matrix matrix = readMatrix(path);
                matrix.MultiplyMatrix();
                matrix.PrintMatrix();
                Console.WriteLine("Press any key to exit.");
            }
            Console.ReadKey();
        }