推 typenephew:太強大啦!!! 12/08 00:48
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int a,b,c;
double D;
cout<<"請輸入係數a,b,c"<<endl;
cin>>a>>b>>c;
D=b*b-4*a*c;
if(D>0)
{
D=sqrt(D);
cout<<((-b+D)/2/a)<<" "<<((-b-D)/2/a);
}
else if(D==0)
cout<<"有重根:"<<-b/2/a;
else
cout<<"無實數解";
system("PAUSE");
return 0;
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.241.88