使用函数将角度从度数转换为弧度
作为更广泛项目的一部分,我给出了一个角度,需要转换为弧度才能进行一些计算。
到目前为止,我有以下内容:
#include #include #include feature1() { double angle = 90.0000, angle2; angle2 = convert_to_rad(angle); printf("%lf", &angle); } double convert_to_rad(double angle_in_deg) { double angle_in_rad; angle_in_rad = (angle_in_deg * M_PI) / 180; return angle_in_rad; }
在NetBeans中编译文件时,我收到以下错误:
note: previous implicit declaration of 'convert_to_rad' was here. error: conflicting types for 'convert_to_rad
为什么不修复格式?
无论如何使用前瞻声明。
即地方
double convert_to_rad(double angle_in_deg);
在开始时(在feature1
function之前)