I didn't really follow your question, but if all your files (for some reason) must be called "main.cpp", then obviously you shall spread them into different directories. It is probably easier, though, to call them "lesson01.cpp", "lesson02.cpp", etc.