sin函数c语言
C ++ sin()函数 (C++ sin() function)
sin() function is a library function of cmath header, it is used to find the sine of the given number (angle), it accepts a number (x) and returns the sine of angle x radians.
sin()函数是cmath标头的库函数,用于查找给定数字(角度)的正弦,接受数字( x )并返回角度x弧度的正弦。
Syntax of sin() function:
sin()函数的语法:
sin(x);
Parameter(s): x – is the value of an angle in radians whose sine to be calculated.
参数: x –是要计算其正弦的弧度角的值。
Return value: double – it returns double type value that is the sine of given angle x radians.
返回值: double-返回double类型值,它是给定角度x弧度的正弦值。
Example:
例:
Input:
float x = 2.45;
Function call:
sin(x);
Output:
0.637765
C ++代码演示sin()函数的示例 (C++ code to demonstrate the example of sin() function)
// C++ code to demonstrate the example of
// sin() function
#include <iostream>
#include <cmath>
using namespace std;
// main() section
int main()
{
float x;
x = -10.23;
cout<<"sin("<<x<<"): "<<sin(x)<<endl;
x = 0;
cout<<"sin("<<x<<"): "<<sin(x)<<endl;
x = 2.45;
cout<<"sin("<<x<<"): "<<sin(x)<<endl;
return 0;
}
Output
输出量
sin(-10.23): 0.720984
sin(0): 0
sin(2.45): 0.637765
Reference: C++ sin() function
参考: C ++ sin()函数
翻译自: https://www.includehelp.com/cpp-tutorial/sin-function-with-example.aspx
sin函数c语言