Current location - Training Enrollment Network - Books and materials - Java middle school book management system
Java middle school book management system
# include & ltiostream & gt

# include & ltmath.h & gt

Use namespace std

Floating point p, q;

void m(int a,int b,int c,float d)

{

p =(-b+ sqrt(d))/(2 * a);

q =(-b-sqrt(d))/(2 * a);

cout & lt& lt" x 1 = & lt; & ltp & lt& lt”“& lt& lt”x2 = " & lt& ltq & lt& lt;

}

void f(int a,int b,int c,float d)

{

p =-b/(2 * a); cout & lt& lt" x 1 = x2 = " & lt; & ltp & lt& ltendl

}

void j(int a,int b,int c,float d)

{

Cout & lt& lt "has no real root" < & ltendl

}

int main()

{

int a,b,c;

Floating d;

Cout & lt& lt "enter A B C"<& ltendl

CIN & gt; & gta & gt& gtb & gt& gtc;

d = b * b-4.0 * a * c;

if(d & gt; 0)

{

m(a,b,c,d);

}

else if(d==0)

{

F (A, B, C, D);

}

other

{

j(a,b,c,d);

}

cout & lt& ltendl

Returns 0;

}