Normally is it common style in C++ that code gots divided and so every class has its own header and cpp file. That improves readability.
When you need to implement a feature, you must write a function. Starting with an empty function body you must fill it with code which does the job.
Like for detecting a cycle you must implement some algorithm like
in this video explained.