This shows you the differences between two versions of the page.
cpp:cmath:acos [2012/10/12 18:35] |
cpp:cmath:acos [2024/02/16 01:04] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | {{keywords>wiki library source code example reference}} | ||
+ | ====== acos ====== | ||
+ | |||
+ | <code cpp> | ||
+ | double acos(double); | ||
+ | </code> | ||
+ | calculates arccosine | ||
+ | |||
+ | |||
+ | ===== cpp Sourcecode Example ===== | ||
+ | |||
+ | <code cpp> | ||
+ | #include <iostream> /* including standard library */ | ||
+ | #include <cmath> /* including math library */ | ||
+ | |||
+ | using namespace std; | ||
+ | int main ( void ){ | ||
+ | double a=0.2, res=0; | ||
+ | res = acos(a) * 90 / 3.17; | ||
+ | |||
+ | //cout.setf(ios::fixed, ios::floatfield); | ||
+ | cout.precision(8); | ||
+ | |||
+ | cout << "acos from " << a << " is " << res << endl; | ||
+ | return 0; | ||
+ | } | ||
+ | |||
+ | </code> | ||
+ | |||
+ | ===== output ===== | ||
+ | |||
+ | acos from 0.2 is 38.879955 | ||
+ | |||