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?
Last edited on
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