#include
<cmath>
double trunc (double x)
Schneidet den Nachkommaanteil der Zahl x
ab (rundet zu Null hin).
x | Gleitkommazahl |
Rückgabewert: ganzzahliger Anteil der Zahl x
.
#include <cmath> #include <iostream> int main() { double x = 12.345; std::cout << std::trunc(x) << '\n'; }