Monday, March 25, 2013

C# 2012: Quadratic Equation

If you are taking college algebra and you think its too difficult to do calculation. One more condition, if you are good in programming like me then go ahead and paste this code in your visual studio and do the college assignment in few minutes.
 I wrote this crapy codes in my c# class, back 2012. I passed maths class with A, because I developed right tool at right time. I have not pasted the .designer.cs file codes. If you have some experience in programming then you will be able to figure out yourself. Any questions, then feel free to comment down. Chill the code !!
 
--> using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;


namespace dQuadratic_Equation
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void btnSolve_Click(object sender, EventArgs e)
        {
            double A = Convert.ToDouble(coeffXx.Text);
            double B = Convert.ToDouble(coeffX.Text);

            double C = Convert.ToDouble(consTant.Text);
           

            double E = -B - Math.Sqrt((Math.Pow(B,2) - 4*A*C));
            double F = -B + Math.Sqrt((Math.Pow(B,2) - 4*A*C));
          
         
            double G = 2 * A;

            double Xp =(E)/(G);
            double Xn = (F)/(G);

            positiveX.Text = Xp.ToString();
            negativeX.Text = Xn.ToString();


        }

        private void btnEraser_Click(object sender, EventArgs e)
        {
          
            coeffX.Clear();
            coeffXx.Clear();
            consTant.Clear();
            coeffXx.Focus();

        }

        private void btnOff_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}

-->

No comments:

Post a Comment