Die Funktion tan () in C ++ gibt die Tangente eines Winkels (Arguments) im Bogenmaß zurück.
Diese Funktion ist in der Header-Datei definiert.
(Mathematik) tan x = tan (x) (In der C ++ - Programmierung)
Prototyp tan () (Stand C ++ 11)
doppelte Bräune (doppeltes x); float tan (float x); lange doppelte Bräune (langes doppeltes x); doppelte Bräune (T x); // Für integralen Typ
tan () Parameter
Die Funktion tan () verwendet ein einzelnes obligatorisches Argument im Bogenmaß (kann positiv, negativ oder 0 sein).
tan () Rückgabewert
Die Funktion tan () gibt den Wert im Bereich von (-∞, ∞) zurück .
Beispiel 1: Wie funktioniert 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; )
Wenn Sie das Programm ausführen, lautet die Ausgabe wie folgt:
tan (x) = 1,55737 tan (x) = 1,73205
Beispiel 2: tan () -Funktion mit Integraltyp
#include #include using namespace std; int main() ( long int x = 6; double result; result = tan(x); cout << "tan(x) = " << result; return 0; )
Wenn Sie das Programm ausführen, lautet die Ausgabe wie folgt:
tan (x) = -0,291006