Beispiel #1
0
        public static void CaseBody(string path, FunсWithIndex funсWithIndex)
        {
            Console.Clear();
            SaveLoad.PrintMsg($"Введите начальную координату отрезка Х1", ConsoleColor.DarkYellow);
            double x1 = CheckCoord();

            SaveLoad.PrintMsg($"Введите конечную координату отрезка Х2", ConsoleColor.DarkYellow);
            double x2 = CheckCoord();

            SaveLoad.PrintMsg($"Введите коэффициент", ConsoleColor.DarkYellow);
            double k = CheckCoord();

            SaveLoad.PrintMsg($"Введите величину шага", ConsoleColor.DarkYellow);
            double step = CheckCoord();

            SaveLoad.SaveFunc(path, x1, x2, k, step, funсWithIndex);
            SaveLoad.TableWithIndex(SaveLoad.Load(path, out min), x1, x2, step, k);
            Console.WriteLine($"Минимальное значение функции = {min:f3}");
            Console.ReadKey();
            Console.Clear();
        }
Beispiel #2
0
        public static void SaveFunc(string path, double a, double b, double k, double step, FunсWithIndex FunсWith)
        {
            FileStream   fs = new FileStream(path, FileMode.Create, FileAccess.Write);
            BinaryWriter bw = new BinaryWriter(fs);
            double       x  = a;

            while (x <= b)
            {
                bw.Write(FunсWith(x, k));
                x += step;
            }
            bw.Close();
            fs.Close();
        }