Mar 29, 2015 at 8:06am
int x =1.7 + 3;
std::cout<<x; //this will print 4.7 as the value of x, how do I make the program print 5 as the approximate value of x?
Mar 29, 2015 at 8:15am
Last edited on Mar 29, 2015 at 8:16am
Mar 29, 2015 at 6:59pm
Oh my bad..
double x =1.7 + 3;
std::cout<<x; //this will print 4.7 as the value of x.
int y = ceil(x);
std::cout<<y; //this prints 5 as the value of x.
thanks @fg109, that was helpful