展开全部
同学,以下请仔细参详, 不是有意做长, 实在是都有用32313133353236313431303231363533e4b893e5b19e31333231383935.
Trigonometry Functions (Sample)
The sample code below illustrates how to use trigonometry (sin, cos, tan, and so on) functions in Visual C++.
Required Header:
Prototype:
// acos
template
inline valarray acos(const valarray& x);
// asin
template
inline valarray asin(const valarray& x);
// atan
template
inline valarray atan(const valarray& x);
// atan2
template
inline valarray atan2(const valarray& x, const valarray& y);
template
inline valarray atan2(const valarray x, const T& y);
template
inline valarray atan2(const T& x, const valarray& y);
// cos
template
inline valarray cos(const valarray& x);
// cosh
template
inline valarray cosh(const valarray& x);
// sin
template
inline valarray sin(const valarray& x);
// sinh
template
inline valarray sinh(const valarray& x);
// tan
template
inline valarray tan(const valarray& x);
// tanh
template
inline valarray tanh(const valarray& x);
Note: The class/parameter names in the prototype do not match the version in the header file. Some have been modified to improve readability.
Description:
This article illustrates the use of STL trigonometry functions through sample code.
Sample Code:
//
//
// Compile options needed: /GX
//
// main.cpp : Illustrates the use of STL trigonometry functions.
//
// Functions:
//
// acos, asin, atan, atan2, cos, cosh, sin, sinh, tan, tanh
//
#include // for i/o functions
#include // for valarray
#include // for trigonometry functions
using namespace std ;
#define ARRAY_SIZE 3 // array