int d=b^2-4ac; //設定判別式if( d > 0 )answer=( -b + sqrt"d" ))/2a or ( -b - sqrt"d" )/2a; //二實根else if( d < 0 )d*=-1;answer=( -b + d*i )/2a or ( -b - d*i )/2a; //二虛根elseanswer=( -b )/2a; //重根(必正)哇~~你們其中考還有先公佈題目喔我們都沒有.....=.=唉..禮拜五也要考程設上機考阿...
double a=double.Parse(textBox1.Text);double b=double.Parse(textBox2.Text);double c=double.Parse(textBox3.Text);double d= Math.Pow(b,2) - 4 * a * c ;double x= Math.Pow(d,0.5);if (d > 0)(-b + x) / (2*a);寫到這就卡住了= =|||
寫出來了@@private void button1_Click(object sender, System.EventArgs e){double a=double.Parse(textBox1.Text);double b=double.Parse(textBox2.Text);double c=double.Parse(textBox3.Text);double d= Math.Pow(b,2) - 4 * a * c ;double x= Math.Pow(d,0.5);double y= (-b + x)/ (2*a);double z= (-b - x)/ (2*a);if (d > 0)label1.Text= y .ToString();elseMessageBox.Show("ERROR");}//終於可以去洗澡了//我昏了= =