Plet a few bugs with missing references to <cstdlib> or <cstdio>, and printf() with wrong argument.