作业帮 > 综合 > 作业

#includeusing namespace std;#define PI 314159double area(dou

来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/11/16 19:19:12
#include
using namespace std;
#define PI 314159
double area(double radius=0);
double area(double a,double b);
double area(double a,double b,double h);
double area(double a,double b,double c,int);
int main(){
cout
#includeusing namespace std;#define PI 314159double area(dou
area.h
#include
#include
#define PI 314159
double area(double radius=0);
double area(double a,double b);
double area(double a,double b,double h);
double area(double a,double b,double c,int);
area.cpp
#inlcude "area.h"
double area(double radius){
return PI*radius*radius;
}
double area(double a,doubleb){
return a*b;
}
double area(double a,double b,double h){
return (0.5*(a+b)*h);
}
double area(double a,double b,double c,int){
double s=0.5*(a+b+c);
return sqrt(s*(s-a)*(s-b)*(s-c));
}
Exp_2.cpp
#include "area.h"
using namespace std;
int main(){
cout
再问: 运行不了!!!
再答: 帮你调试了下,你的代码有错,- -..我帮你改好了.. area.h #include #include #define PI 314159 double area(double radius=0); double area(double a,double b); double area(double a,double b,double h); double area(double a,double b,double c,int); area.cpp #include #include "area.h" double area(double radius){ return PI*radius*radius; } double area(double a,double b){ return a*b; } double area(double a,double b,double h){ return (0.5*(a+b)*h); } double area(double a,double b,double c,int){ double s=0.5*(a+b+c); return sqrt(s*(s-a)*(s-b)*(s-c)); } Exp_2.cpp #include #include "area.h" using namespace std; int main(){ cout