首页 > 知识问答文章正文

C语言简单编程之一元二次方程求解

知识问答 2022-03-28 21:12:22 admin

操作方法

【步骤01】

# include
# include
void main(void)

【步骤02】

void main(void)
{
double a,b,c,x1,x2;
cout<<"input a,b,c:";
cin>>a>>b>>c;
double s=b*b-4*a*c;
if(s>=o)

【步骤03】

{
double sqrtVal=sqrt(s);
x1=(-b+sqrtVal)/(2*a);
x2=(-b-sqrtVal)/(2*a);
cout<<"x1="<cout<<"x2="<}

【步骤04】

else
cout<<"this question does not hava a real answer"<
}

标签:

发表评论

评论列表

可盼网Copyright @ 2011-2024 All Rights Reserved. |版权所有 备案号: 豫ICP备2022006457号-8