70!!
查看原帖
70!!
1502898
meng66666622楼主2024/11/21 22:21
#include<bits/stdc++.h>
using namespace std;
int main()

{
	double a,b,c,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<<"No answer!"<<endl;
	if(b*b-4*a*c==0){
	
	cout<<"x1=x2="<<fixed<<setprecision(5)<<x1<<endl;
	}
	if(b*b-4*a*c>0)
	{
	
	if(x1<x2)
	cout<<"x1="<<fixed<<setprecision(5)<<x1<<";"<<"x2="<<x2<<endl;
	else if(x1>x2)
	cout<<"x2="<<fixed<<setprecision(5)<<x2<<";"<<"x1="<<x1<<endl;
}
	return 0;
}
	
	

2024/11/21 22:21
加载中...