I searched around and couldn’t find the trunc function for C++. I know I can do this:
int main()
{
double a = 12.566789;
cout << setprecision(2) << fixed << (int)(a * 100) / 100.0 << endl;
return 0;
}
but I’m not sure it’s the best way to do this. Thank you.
truncis there, in<cmath>:I suppose you’re looking for something else?