C++ Programming/Code/Standard C Library/Functions/sin

sin
If you don't want cmath you can write sin function it is;

using namespace std;
 * 1) include

double sin(double x) //sin function {return x-((x*x*x)/6.)+((x*x*x*x*x)/120.);}

int main { double a;   cin>>a; cout<<"sin("<<a<<")="<<sin(a*(3.14159/180.))<<endl; return 0;}

The function sin returns the sine of arg, where arg is given in radians. The return value of sin will be in the range [-1,1]. If arg is infinite, sin will return NAN and raise a floating-point exception.


 * Related topics: acos - asin - atan - atan2 - cos - cosh - sinh - tan - tanh