如何编写一元二次方程程序
来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/11/10 20:44:09
如何编写一元二次方程程序
用C++
用C++
//Equation.h
#ifndef _Equation_h
#define _Equation_h
class Equation
{
private:
double a;
double b;
double c;
void ShowEquation();
public:
Equation():a(0),b(0),c(0){};
Equation(double a2,double b2,double c2):a(a2),b(b2),c(c2)
{
ShowEquation();
}
Equation(){}
void SetEquation();
void ShowResult();
};
#endif //_Equation_h
//Equation.cpp
#include "Equation.h"
#include
using namespace std;
void Equation::SetEquation()
{
cout a;
cout > b;
cout > c;
cout
#ifndef _Equation_h
#define _Equation_h
class Equation
{
private:
double a;
double b;
double c;
void ShowEquation();
public:
Equation():a(0),b(0),c(0){};
Equation(double a2,double b2,double c2):a(a2),b(b2),c(c2)
{
ShowEquation();
}
Equation(){}
void SetEquation();
void ShowResult();
};
#endif //_Equation_h
//Equation.cpp
#include "Equation.h"
#include
using namespace std;
void Equation::SetEquation()
{
cout a;
cout > b;
cout > c;
cout