Refactor code, details below
Modify string.h -> cstring
Use namespace to avoid conflicts
Use EXIT_FAILURE instead of exit(-1)
Remove redundant error variable since it is not used after initialised