#include // This method is not as good as the one in 2.cc because it uses the // ?: ternary operator, which is basically a more succinct (and more // confusing) way of writing an if statement inside an expression. // If you don't understand what this does or how it works, you don't // need to worry about it. long round(double x) { return static_cast(x + ((x < 0) ? -1 : 1) * 0.5); } int main() { double number; while (std::cin >> number) { std::cout << round(number) << std::endl; } }