Return to Snippet

Revision: 34550
at October 25, 2010 02:07 by dr3amerr


Initial Code
#include <iostream>
#include <math.h>
using namespace std;
 
void main()
{
float a, b, c, dis, x1, x2;
cout << "Enter a: ";
cin >> a;
cout << "Enter b: ";
cin >> b;
cout << "Enter c: ";
cin >> c;
dis = b*b - 4*a*c;
if ( dis>= 0 )
{
x1 = (b - sqrt (dis) ) / 2*a;
x2 = (b + sqrt (dis) ) / 2*a;
cout << "The result is" << x1 << " and " << x2 << endl;
} else
{
cout << "Dis is less than 0\n";
}
}

Initial URL


Initial Description
A simple program solving a biquadratic equation.

Initial Title
biquadratic equation source code

Initial Tags
code

Initial Language
C++