struct point{
double x,y;
}
double length(struct point a,struct point b){
return sqrt(pow(a.x-b.x,2)+pow(a.y-b.y,2));
}
#include
struct point
{
double x, y;
};
double length(struct point a, struct point b)
{
return sqrt(pow(a.x-b.x, 2)+pow(a.y-b.y,2));
}
原型:double pow (double base, double exponent);
struct point
{
double x, y;
};
double length(struct point a, struct point b)
{
return sqrt(pow(a.x-b.x, 2.0)+pow(a.y-b.y,2.0));
}
#include
见鬼!为什么math.h用尖括号括起来不好用?
需要包含所需要的头文件
#include 新的;
或#include “Math.h” 老的。
头文件在哪里?你这个是头文件?
当然,任何代码都可以放在头文件中,但是我们不建议把函数的实现放在头文件,同时最好给头文件加上
#ifndef __DEF__头文件名__H
#define __DEF__头文件名__H
头文件的内容
#endif
避免重复包含头文件带来编译错误
struct point
{
double x, y;
};
double length(struct point a, struct point b)
{
return sqrt(pow(a.x-b.x, 2)+pow(a.y-b.y,2));
}
需要包含所需要的头文件
#include 新的;
或#include “Math.h” 老的。