📄 yiyuan.cpp
字号:
#include <iostream.h>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
void main()
{ double a,b,c,s,x1,x2,t;
cout<<"Please enter a,b,c\n";
cin>>a>>b>>c;
cout<<"输入方程是:\n";
cout<<a<<"*(X*X)"<<"+"<<b<<"*X"<<"+"<<c<<"="<<"0"<<endl;
cout<<'\n';
s=b*b-4*a*c;
t=sqrt(fabs(s));
cout<<s<<endl;
if(s=0)
{
cout<<"There is only one x\n";
x1=x2=(-b)/(2*a);
}
else if(s>0)
{
cout<<"There are two x\n";
x1=(-b+t)/(2*a);
x2=(-b-t)/(2*a);
}
else if(s<0)
{
cout<<"There is no such x\n";
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -