C语言中cos(x)或sin(x),x输入的是弧度,怎么输入角度 | 您所在的位置:网站首页 › 语言表达是什么角度 › C语言中cos(x)或sin(x),x输入的是弧度,怎么输入角度 |
#define PI (3.14159265358979323846) #define PI_DIV_180 (0.017453292519943296)//π/180 #define DegToRad(x) ((x)*PI_DIV_180)//角度转换为弧度 让我们稍微写几行代码就可以验证其结果: // sin(x)中x角度还是弧度问题.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include #include #define PI 3.1415926 using namespace std; int _tmain(int argc, _TCHAR* argv[]) { float angle = 30;//角度 float rad = PI / 6;//弧度 float resultAngle = sin(angle); float resultRad = sin(rad); cout |
今日新闻 |
推荐新闻 |
专题文章 |
CopyRight 2018-2019 实验室设备网 版权所有 |