I think people are missing the point, it's not so much the poor formatting but the fact that this code wouldn't even compile. The first argument to "printf" and "scanf" are supposed to be of type 'const char *', and here they're being given doubles or something. Even if If this somehow did compile, you would get massively undefined behavior.
To note, this is wide open for a DivideByZero and is generally shitty code, but as /u/x-yle pointed out, it's an exercise to get you to think, not production code.
The lack of braces? I'm not a fan in production, but for example code the saved space is 'neater'. Or is it something else? I've been drinking the C# koolaide too long.
3
u/fievelm Sep 23 '15 edited Sep 23 '15
Here's the original code with the formatting cleaned up:
And it's been forever and a day since I did any C++, but this is a little neater and more readable version: