C ++ tan () - C ++ standaardbibliotheek

De functie tan () in C ++ geeft de tangens van een hoek (argument) terug in radialen.

Deze functie is gedefinieerd in het header-bestand.

 (Wiskunde) tan x = tan (x) (in C ++ programmeren)

tan () prototype (vanaf C ++ 11-standaard)

dubbelbruin (dubbel x); float tan (float x); lang dubbel bruin (lang dubbel x); dubbele tan (T x); // Voor integraal type

tan () Parameters

De functie tan () heeft één verplicht argument in radialen (kan positief, negatief of 0 zijn).

tan () Retourwaarde

De functie tan () retourneert de waarde in het bereik van (-∞, ∞) .

Voorbeeld 1: Hoe werkt tan () in C ++?

 #include #include using namespace std; int main() ( long double x = 0.99999, result; result = tan(x); cout << "tan(x) = " << result << endl; double xDegrees = 60.0; // converting degree to radians and using tan() fucntion result = tan(xDegrees*3.14159/180); cout << "tan(x) = " << result << endl; return 0; )

Wanneer u het programma uitvoert, is de uitvoer:

 tan (x) = 1.55737 tan (x) = 1.73205

Voorbeeld 2: tan () functie met integraal type

 #include #include using namespace std; int main() ( long int x = 6; double result; result = tan(x); cout << "tan(x) = " << result; return 0; ) 

Wanneer u het programma uitvoert, is de uitvoer:

 bruin (x) = -0,291006

Interessante artikelen...