an error "expected unqualified-id before string constant" when compiling

Check your indentation.
This flavour of C++ doesn't allow function declarations inside other functions.

Here someone else suggested you concentrate on indentation.