private static void PrintApproximatedLobachevskyRoots(double[] roots) { Console.Clear(); string method = ReadApproximationMethod(); InitApproximationMethods(method); double[] approximatedRoots = LobachevskyMethod.GetApproximateRoots(GetRootFindingFunction, roots); for (int i = 0; i < roots.Length; i++) { Console.WriteLine("\tBefore: {0} After: {1}", roots[i], approximatedRoots[i]); } }
static void OutputLobachevskyConsole() { Console.WriteLine("Roots calculated by Lobachevsky method:"); double[] roots = LobachevskyMethod.Calculate(); foreach (var root in roots) { Console.WriteLine("\t{0}", root); } Console.WriteLine("Select option to continue:"); Console.WriteLine("1. Get approximated roots."); Console.WriteLine("0. Back."); string option = Console.ReadLine(); switch (option) { case "1": { try { PrintApproximatedLobachevskyRoots(roots); } catch (Exception e) { Console.WriteLine("\t{0}", e.Message); } finally { Console.WriteLine("PRESS ANY KEY TO GO TO MAIN MENU."); Console.ReadLine(); } break; } case "0": default: return; } }