private void ShowAnswerPage() { List <RealNum> exp = new List <RealNum>(); BaseEquation equ = new BaseEquation(); exp = equ.MakeEasyH1(inputBox.Text); exp = equ.MakeEasyM1(exp); exp = equ.MakeEasyM2(exp); int a = (int)EquationTools.GetFrontByTimes(exp, 2); int b = (int)EquationTools.GetFrontByTimes(exp, 1); int c = (int)EquationTools.GetFrontByTimes(exp, 0); int XDown = 2 * (int)a; if (b * b - 4 * a * c < 0) { showInformation("Error", "b*b-4*a*c<0"); return; } //¡Ì string answer = new Trans().GetX(a, b, c); answer = answer.Replace("¡Ì", "√"); txt_AnswerTextBlock.Text = answer; /* fraction fa = new fraction(a); * fraction fb = new fraction(b); * fraction fc = new fraction(c); * fraction diat = new fraction(b * b - 4 * a * c); * diat.numsqrt(); * fraction x1 = (-fb + diat) / (new fraction("2") * fa); * fraction x2 = (-fb - diat) / (new fraction("2") * fa); * txt_AnswerTextBlock.Text = "x1:" + x1.ToString() + "\n"; * txt_AnswerTextBlock.Text += "x2:" + x2.ToString();*/ }
private void btn_Count_Click(object sender, RoutedEventArgs e) { txt_AnswerTextBlock.Text = ""; BaseEquation equ = new BaseEquation(); if (!equ.Checker(inputBox.Text)) { return; } if (inputBox.Text.Length == 0) { return; } List <RealNum> Exp = new List <RealNum>(equ.MakeEasyH1(inputBox.Text)); if (Exp[Exp.Count - 1].times == 2 && Data.localSettings.Values["RealMode"].ToString() == "on") { ShowAnswerPage(); return; } List <float> xValue = new List <float>(); xValue = equ.Getxvalue(inputBox.Text); for (int i = 0; i < xValue.Count; i++) { txt_AnswerTextBlock.Text += " x" + i + "=" + xValue[i] + " "; } }