How to using cpp to create speedtree in ue

Hey @Joexiong11! Welcome to the Forums!

I believe what might be looking for is procedural mesh generation or geometry scripting. Here are some Epic and non-Epic affiliated guides and documentation to get you started for reference:

Non-Epic Affiliated

Good luck with your procedural trees!