411 REFERENCE · Wikibooks
C++ Programming/Code/Standard C Library/Functions/sin
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
sin
#include <cmath>
double sin( double arg );
If you don't want cmath you can write sin function it is;
include <iostream>
using namespace std;
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