math - Is there a trunc function in C++? -



math - Is there a trunc function in C++? -

i searched around , couldn't find trunc function c++. know can this:

int main() { double = 12.566789; cout << setprecision(2) << fixed << (int)(a * 100) / 100.0 << endl; homecoming 0; }

but i'm not sure it's best way this. give thanks you.

trunc there, in <cmath>:

#include <iostream> #include <cmath> int main() { std::cout << trunc(3.141516) << std::endl; }

i suppose you're looking else?

c++ math

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -