// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
#include <iostream>

using namespace std;

int main()
{
   int i;
   double d;
   d = 123.456;
   i = d; // implicit konvertering fra double til int - will often give warning
   cout << i << endl;
   i = (int)d; // eksplicit konvertering fra double til int (C style)
   cout << i << endl;
   i = int(d); // eksplicit konvertering fra double til int (C++ style)
   cout << i << endl;
   i = static_cast<int>(d); // eksplicit konvertering fra double til int (new C++ style)
   cout << i << endl;
   return 0;
}
