First, if you really want to learn C++, I suggest you take a look at the following website:http://www.learncpp.com/
Second, I recommend you install an Integrated Development Environment (IDE). My favorite IDE is Microsoft Visual C++. If you install an IDE, it will most likely install the compiler for you. Then you just click a button, and it will compile your program. Using an IDE is incredibly useful in many different ways, including color coding, and a better way to organize your projects.
If you don't want to install an IDE, you can always compile directly from Command Prompt. First, you'll want to download a C++ compiler. Open Command Prompt (you can do this by searching for cmd.exe). Assuming your main class is called HelloWorld, from the command line, type:
- g++ -o HelloWorld HelloWorld.cpp
Expand to see the code.
This will compile and link HelloWorld.cpp. To run it, type: HelloWorld (or whatever your main class is called), and you will see the output of your program.