Hello everyone!
I'm reading some exericses and it wants me to round the number to the nearest integer. Okay this is quite easy I thought, but does this mean if i have:
34.6 to print 34
or does it mean
34.6 to print 35?
my code does the first thing, it prints 34 not 35.
this just truncates the decimal number and prints 34! is this right?Code:double x = 34.6; cout <<"x: " << static_cast<int>(x) << endl;
Thanks for listening,![]()




Reply With Quote