예제 #1
0
파일: cx.cs 프로젝트: eddylin2015/SALForm
        static void run_console(string[] args)
        {
            SampleVarMgr tvm = new SampleVarMgr();
            CalcMachine  cs  = null;

            if (args.Length > 0)
            {
                cs = new CalcMachine(tvm, args[0]);
            }
            else
            {
                System.IO.StreamReader srRules = new StreamReader("rule.out");
                cs = new CalcMachine(tvm, srRules);
            }

            /*顯示運算式中變數值
             */
            Console.WriteLine("Initalize Variables:");
            foreach (DictionaryEntry entry in tvm.getHashtable())
            {
                Console.WriteLine(entry.Key + " = " + entry.Value);
            }
            Console.WriteLine("---------------");
            cs.Cal();

            /*顯示運算式中變數值
             */
            Console.WriteLine("Values After Calculation:");
            foreach (DictionaryEntry entry in tvm.getHashtable())
            {
                Console.WriteLine(entry.Key + " = " + entry.Value);
            }
            Console.WriteLine("---------------");
            Console.ReadLine();
        }
예제 #2
0
파일: cx.cs 프로젝트: eddylin2015/SALForm
        public static void run_test_cx(string srRules, TextWriter _output)
        {
            SampleVarMgr tvm = new SampleVarMgr();
            CalcMachine  cs  = new CalcMachine(tvm, srRules);

            /*顯示運算式中變數值
             */
            _output.WriteLine("Initalize Variables:");
            foreach (DictionaryEntry entry in tvm.getHashtable())
            {
                _output.WriteLine(entry.Key + " = " + entry.Value);
            }
            _output.WriteLine("---------------");
            cs.Cal();

            /*顯示運算式中變數值
             */
            _output.WriteLine("Values After Calculation:");
            foreach (DictionaryEntry entry in tvm.getHashtable())
            {
                _output.WriteLine(entry.Key + " = " + entry.Value);
            }
            _output.WriteLine("---------------");
        }