floor???

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <iostream>
#include <iomanip>
#include <conio>

int main()
{
   double x=781.2856789;
   cout<<setiosflags(ios::showpoint|ios::fixed);
   cout<<setprecision(5);
   cout<<x<<endl;
   cout<<(floor(x*100+0.5)/100)<<endl;
   cout<<(int(x*100+0.5)/100)<<endl;

   getch();
   return 0;
}


Can anyone tell me what is floor? And which library to use? TQ...
http://www.cplusplus.com/reference/clibrary/cmath/floor/ (in short: it rounds down).

And which library to use?
Library for what?
Last edited on
use math.h

and floor Returns the largest integral value that is not greater than x
Thanks...

May I know what is this for cout<<setiosflags(ios::showpoint|ios::fixed);?
Topic archived. No new replies allowed.