示例#1
0
文件: Form1.cs 项目: tvrjcf/Demo
 private void button1_Click(object sender, EventArgs e)
 {
     if (textBox1.Text.Length > 0)
     {
         textBox2.Text = _arith.Compute(textBox1.Text).ToString();
     }
 }
示例#2
0
        /// <summary>
        /// Add a new coordinate into this system
        /// </summary>
        /// <param name="f">function</param>
        /// <param name="nameTerms">terms identified by name and ordered as same to coords</param>
        /// <param name="coords">coordinate</param>
        public void Add(Arithmetic f, IEnumerable <string> nameTerms, params double[] coords)
        {
            int index = 0;

            foreach (string u in nameTerms)
            {
                if (index < coords.Count())
                {
                    f.Let(u, coords.ElementAt(index));
                    ++index;
                }
                else
                {
                    break;
                }
            }
            Interfaces.IArithmetic fd = f.Compute();
            if (f is NumericValue)
            {
                List <double> c = new List <double>(coords);
                c.Add(Convert.ToDouble(f));
                Coordinates src = new Coordinates(c);
                src = this.move.Floor(src);
                this.Add(src);
            }
            else
            {
                // un ou plusieurs termes n'ont pas de valeur
                throw new KeyNotFoundException();
            }
        }
示例#3
0
文件: Form1.cs 项目: tvrjcf/Demo
        private void button1_Click(object sender, EventArgs e)
        {
            _am.Vars["时间"] = QC.Int(textBox2.Text);
            _am.Vars["路径"] = QC.Int(textBox3.Text);
            object r = _am.Compute(textBox1.Text);

            label4.Text = "结果  " + r.ToString(  );
        }
示例#4
0
        public override void Start()
        {
            Logger.Start("计算器");

            Arithmetic calc   = new Arithmetic();
            object     result = calc.Compute("2 + (23) - 2");

            Logger.Write(result);
        }