#include <iostream> #include <math.h> #include <conio.h> using namespace std; const double M_PI = 3.14159265358979323846; // 度转弧度 #define DEGTORAD(deg) (deg*M_PI/180.0f) // 输入角度以度为单位的sin函数(系统提供的sin函数的输入是以弧度为单位的,其它三角函数也是) double sin_deg(double deg) { return sin(DEGTORAD(deg)); } int main(void) { cout<<sin_deg(0)<<endl; cout<<sin_deg(30)<<endl; cout<<sin_deg(90)<<endl; getch(); return 0; }