/*
    Type Coercion.   Nyhoff P 71.

    We can convert doubles x to an int doing int(x) or (int)x, and similar
    convert an int n to a double by double(n) or (double)n.
    
    This is called type coercion, but it can result in loss of accuracy.
*/

#include <iostream>
using namespace std;

int main()
{
   int n=47;
   int m=5;

   cout << n/m << endl;             //  integer division. 47/5 = 9   
   cout << double(n)/m << endl;     //  floating point division. 47.0/5.0=9.4
   cout << n/double(m) << endl;     //  floating point division. 47.0/5.0=9.4
   
   
   double pi=3.141592;   
   double small=1e-5;   
   double big=1e+10;   

   cout << int(pi) << endl;         // double converted to int..
   cout << int(small) << endl;      // What happens?
   cout << int(big) << endl;        // What happens?
   
   return 0;
}
