How do I reinstall macOS to my Mac after formatting the main drive accidentally? I recently installed Windows to my Mac and I have just formatted my hard drive on windows mistakenly while I was making a new hard drive partition on Windows. Now I cannot boot to macOS anymore. 

How do I reinstall macOS to my Mac?
It isn't clear if you have one or two hard drives in your machine. Nevertheless, the only thing that comes to mind, if you can't access another Mac to make a bootable USB drive, is boot from Internet Recovery, and reinstall OSX.

To enter this mode Internet Boot Recovery, do the following: 


In the Apple menu, choose Restart or power on your Mac. 
As the computer restarts, hold down the cmd/⌘+opt/⌥+R combination immediately upon hearing the startup chime. Hold the keys until the animated globe appears on the screen.


From there follow the instructions and reinstall the original OS your Mac was delivered with. Then update to the latest macOS.