![]() |
#2
yangfrancis2017-09-29 11:56
|
#include <iostream.h>
#include <stdlib.h>
#include <math.h>
#include <stdio.h>
#include<conio.h>
void main()
{
double a,b,c,delta,x1,x2;
a=1;
b=2;
c=1;
//cin>>a>>b>>c;
if (a==0&&b==0)
cout<<"feiyiyuanercifangcheng\n";
else
if (a==0&&b!=0) //bx+c=0
cout<<"gaifangchengweiyiyuanyicifangcheng,jiewei:"<<-c/b<<'\n';
else
{
delta=b*b-4*a*c;
if (delta<0)
cout<<"fangchengwujie\n";
else
if (delta==0)
cout<<"gaifangchengyoulianggexiangdengdeshishujie:"<<-b/(2*a)<<'\n';
else
{
x1=(-b+sqrt(delta))/(2*a);
x2=(-b-sqrt(delta))/(2*a);
cout<<"gaifangchengyoulianggebudengdeshigenjie:"<<x1<<'\t'<<x2<<'\n';
system("PAUSE");
}
}
system("PAUSE");
}
只有本站会员才能查看附件,请 登录