Example #1
0
        static public string AskFormula(string text)
        {
            string output;

            Console.Write("\r" + new string(' ', Console.WindowWidth - Console.CursorLeft) + "\r" + text);
            output = Console.ReadLine();
            while (!Rpn.IsExpressionCorrectly(output, out string errorText))
            {
                Console.SetCursorPosition(0, 0);
                Console.Write("\r" + new string(' ', Console.WindowWidth - Console.CursorLeft) + "\r" + errorText);
                Console.ReadKey(true);
                Console.Write("\r" + new string(' ', Console.WindowWidth - Console.CursorLeft) + "\r" + text);
                output = Console.ReadLine();
            }

            return(output);
        }
Example #2
0
 public bool FormulaCorrectlyTest(string formula)
 {
     return(Rpn.IsExpressionCorrectly(formula, out string s));
 }