Update main.cpp

adding conversion of octal and some error checking