#include
#include
#include
using namespace std;
The class equation
{
Float a, b, c, x1, x2, delta;
Value (void);
Public:
Equation (aa, float float bb, float cc);
Void the show ();
};
Equation: : equation (aa, float float bb, float cc)
{
While (fabs (aa) & lt; 1 e - 6 & amp; & Fabs (bb) & lt; 1-6 e) {
Cout & lt; <"Equation coefficient of a b c there is an error, \ n";
Cout & lt; <"Please re-enter a, b, c value:";
Cin & gt;> Aa & gt;> Bb & gt;> Cc.
}
A=aa; B=bb; C=cc;
}
Void equation: : value ()
{
The delta=b * * a * b - 4 c.
If (delta & gt;=0) {
X1=(a - b + SQRT (* a * b * b - 4 c))/(2 * a);
X2=(a - b - SQRT (* a * b * b - 4 c))/(2 * a);
}
}
Void equation: : show ()
{
If (a!=0) {
The value ();
If (delta & gt; 0 {
Cout & lt; <"There are two not equal real root, respectively is:";
Cout & lt; <"X1=" & lt;
} else if (b!=0)
Cout & lt; <"The root of equation is"
<"X=" & lt; <- c/b & lt;
Int main ()
{
Equation A (1, 2, 15), B (1, 7, 0);
A.s how ();
B.d raw ();
getchar();
return 0;
}
The error
CodePudding user response:
B.s how ();