#include <iostream>
#include <cmath>

#ifdef CPP11
    #define ROUND(x) std::round(x)
#else    /* CPP11 */
inline double myRound(double x) {
    return (x >= 0.0 ? std::floor(x + 0.5) : std::ceil(x - 0.5));
}

    #define ROUND(x) myRound(x)
#endif   /* CPP11 */


int main()
{
   std::cout << "0.3 rounds to " << ROUND(0.3) << std::endl;
   std::cout << "With std::round(), it's " << std::round(0.3) << std::endl;
   std::cout << "-0.3 rounds to " << ROUND(-0.3) << std::endl;
   std::cout << "With std::round(), it's " << std::round(-0.3) << std::endl;
   std::cout << "12.8 rounds to " << ROUND(12.8) << std::endl;
   std::cout << "With std::round(), it's " << std::round(12.8) << std::endl;
   std::cout << "-31.6 rounds to " << ROUND(-31.6) << std::endl;
   std::cout << "With std::round(), it's " << std::round(-31.6) << std::endl;
   
   return 0;
}

