If you want to write programs and snippets along the way, it's a great idea to get a development tool like IntelliSense or NetBeans.

Open your tool and create a new C++ project. Once you've filled in some details, you'll have a ready-to-go main.cpp file with a main() function.

Nice work! In your tool, you'll also find a Build button to build, or compile, your program and a Run button to execute it.