A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://en.wikibooks.org/wiki/C++_Programming/Code/Standard_C_Library/Functions/sin below:

C++ Programming/Code/Standard C Library/Functions/sin - Wikibooks, open books for an open world

From Wikibooks, open books for an open world

Syntax
#include <cmath>
double sin( double arg );

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

  1. 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

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4