#include <iostream> using namespace std; //a b c float a*x^2+b*x+c=0 struct ReturnType { int type; vector<float> store; }; //multi-back vector<float> solveFun(float a,float b,float c) { float x1,x2; float delta=b*b-4*a*c; vector<float> ans; bool flag=0; if(a==0) { if(b==0) { if(c==0) { cout<<"meets any value"<<endl; } else { cout<<"False Input"<<endl; } } else { x1=-c/b; ans.push_back(x1); } flag=1; } if(flag==1) return ans; if(delta>0) { x1=(-b+sqrt(delta))/(2*a); x2=(-b-sqrt(delta))/(2*a); ans.push_back(x1); ans.push_back(x2); cout<<"Roots Real&diff:"<<"x1: "<<x1<<"x2: "<<x2<<endl; } else if(delta==0) { x1=(-b+sqrt(delta))/(2*a); ans.push_back(x1); cout<<"Roots Real&same:"<<"x1: "<<x1<<endl; } else { cout<<"Roots not Real"<<endl; } return ans; } int main() { float a,b,c; cout << "Hello World"; return 0; }
愿为天下目,萃聚六路华
浙公网安备 33010602011771号