Cube c++ problem!!!

HELP ME WHITH THIS PROBLEM!!!

It is the following, what is needed is to make a cube divided into 8 small cubes.
Having already the cube, you must put a function which allows me
to rotate the cube (either with the mouse or keyboard) and another
function which allows that when you click on one of the small cubes, it undocks and when you
return click, it will dock back to the cube. The big problem is that it should only be done with C ++ and not using blueprints. I NEED URGENT HELP WITH THIS PLEASE !!!