fixed a few trivial clang warnings:
missing #includes, mismatch in format strings,
missing main() return value, added braces to disambiguate dangling else.