#include<iostream> #include<cstdlib> #include<cmath> using namespace std;
int main() { float a,b,c,d,e,f; cin>>a>>b>>c; d=b*b-4*a*c; e=(-b+sqrt(d))/(2*a); f=(-b-sqrt(d))/(2*a); if (d>0) cout<<"有兩個根,為"<<e<<"," <<f<<endl; else if (d==0) cout<<"有一個根,為"<<e<< endl; else if (d<0) cout<<"沒有實根"<< endl; system("pause"); return 0; } |