error C2601: ‘main’ : local function definitions are illegall – MS VS 2013 Compiler
Your bracketing is broken. The net result is that you are attempting to define your main function inside ciong. And C++ does not support nested function definitions. Hence the compiler error. The code should be: And there are other bugs. For example, you meant cout << ciong(n).