It is a clear task for you
to debug your code. For learning to code and to use the debugger you can visit Learn C++
and search for the debugger chapters.
Your function isCycle looks like you missed some real code. Return true and false and not
1 or 0.
To be honest: your code doesnt look like a solution, but some copied and pasted pieces without sense.
Tip: write some tests with known data, so you can check easily for the working of the code.