#28591: AC?? (求大神幫我解答)


deanlin94@gmail.com (林廷恩)


using namespace std;

 

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

 

int main() 

{

 int a,b,c; 

 int x1,x2;

 

 cin>>a>>b>>c;

 x1=(-b+sqrt(b*b-4*a*c))/(2*a);

 x2=(-b-sqrt(b*b-4*a*c))/(2*a);

 

 if(b*b-4*a*c>0)

 {

  cout<<"Two different roots x1="<<x1<<"  x2="<<x2<<endl;

 

 }

 else if(b*b-4*a*c==0)

 {

  cout<<"Two same roots x="<<x1<<endl; 

 

 }

 else

 {

  cout<<"No real root"<<endl;

 }

 

  return 0;

}

#28592: Re:AC?? (求大神幫我解答)


cges30901 (cges30901)


  cout<<"Two different roots x1="<<x1<<"  x2="<<x2<<endl;

 


少一個逗號