There are several alternatives for compiling C++ on windows. Let's look at 2 of them:
To install GCC on Windows you need to install MinGW. To install MinGW, go to the MinGW homepage, www.mingw.org, and follow the link to the MinGW download page. Download the latest version of the MinGW installation program which should be named MinGW-<version>.exe.
While installing MinGW, at a minimum, you must install gcc-core, gcc-g++, Binutils, and the MinGW runtime, but you may wish to install more.
Add the bin subdirectory of your MinGW installation to your PATH environment variable so that you can specify these tools on the command line by their simple names.
When the installation is complete, you will be able to run gcc, g++, ar, ranlib, dlltool, and several other GNU tools from the Windows command line.
For a detailed installation guide, visit: https://www.compile.work/guides/installation/windows/gcc.html
If you'd rather use an IDE for C++ development, you can install the devC++ compiler/IDE for windows. Download the exe file from https://bloodshed-dev-c.en.softonic.com/ and follow the instructions there to install it. Installation is pretty straightforward.