The C++ programming language is one of the most popular programming languages and often features among the two three languages on any lists. Perhaps now you want to start programming in C++ but don’t know where to start? In this post, we explain simply how you can download a free C++ IDE and compiler and how you can start coding with hello world C++ examples as a first step.
Table of Contents
How to download and run a C++ program
C++ is a powerful programming language with many features that enable you to write almost any app you could ever want. Using a fast and reliable C++ Compiler and IDE is very important for beginners and professionals to develop C++ apps for Windows and other operating systems. When a user wants to develop modern C++ applications, they should learn to use a professional IDE.
C++ Builder CE is the easiest and fastest C & C++ IDE for developing simple or professional applications on different operating systems. It is also easy for beginners to learn with its wide range of samples, tutorials, help files and LSP support. C++ Builder comes with Rapid Application Development Studio, also knowns as RAD Studio, and C++ Builder is one of the most professional IDEs that work under RAD Studio.
C++ Builder IDE has mainly 5 Parts, the Code Editor Window and Form Designer, Projects Window, Palette Window, Structure Window, Object Inspector Window. You can find more , less commonly used windows from the main IDE menu as well as the right-click context menus. All the basic sections can be summarized in this IDE picture;
You can download the free C++ Builder Community Edition here: https://www.embarcadero.com/products/cbuilder/starter.
Professional developers can use the Professional, Architect or Enterprise versions of C++ Builder. Please visit https://www.embarcadero.com/products/cbuilder.
How to run a C++ program
If you download C++ Builder Community Edition (or RAD Studio CE version) or any Professional, Architect, Enterprise versions of C++ Builder, or Dev-C++, VC++, GNU C/C++ then we can start to code, you can follow these steps to run your program,
- Create a new Project (a console application, a solution)
- Start coding with very simple code and save all project files including cpp files.
- Press Run Button or Keys of IDE, or use a compiler to compile your codes.
As an example, now, let’s do these steps in C++ Builder.
- Use menu File ->New->”Console Application – C++ Builder” to create a new C++ console application. In the next window, press OK to write your codes.
When you start coding, first of all, you should include libraries that you wish to use. The C++ language has many libraries and each of them has commands or functions for specific tasks. For example, the iostream
library has standard input and output methods to display data and read from files and similar sources. Generally, for beginners, the iostream
header is enough to enable you to create simple apps. We can include this library header as below,
Second, you should add a main
procedure. This is the main part of the program – hence the name – and it is executed first. In the simplest sense, all other parts of your program are launched from the main section either directly or indirectly. Things get a little more complicated than that once you start to write more complex programs but for now you can think of the main
section as the ‘main loop’ where things begin to happen in your program code.
After that you should write your lines of program code into this procedure, between the { and } brackets. If you are a beginner, “Hello World” examples are good to understand how the basic feature of a particular programming language works. It is also a good way to understand how to edit text, how the syntax (the rules) of the language work, how to compile and link, how to debug and execute, and how to deploy or release. This full example below is a “Hello World” C++ example that can be run with C++ Builder too.
Here is Hello World C++ example as a console application,
In C and C++, after every command you use you should put a semicolon “;”. In this example above we print a text with std::cout method and then we wait to get a character input (key press) with getchar();
functions, then we exit and return 0;
which means our main app has run successfully and exits.
In this example above we define main() function as a integer (int) function, that means we should return a integer value. Here, we print a text with printf()
function and then we wait to get a character input (key press) with getchar();
function, sometimes this is necessary to see results when running it. Then we exit and return 0;
which means our main app successfully ran and exited.
You can write these C++ codes above into Dev-C++ code editor or you can copy and paste it. If you are a beginner, we highly recommend you to write codes. This will help you to understand how C++ works and you can see your first mistakes when you are coding.
2. coding is done now you can save all your project files to a folder. Use File->Save Project As to save all your files.
3. After this step, you can compile and run by pressing F9, or you can run your code by pressing F10, or you can use Compile and Run buttons editor. This will print out the “Hello LearnCPlusPlus”. C++ compilers support C language too
Although the free C++ Builder Community Edition is extremely powerful it is intended for students, beginners, and startups. If you are a regular business or do not qualify for the free community edition, then you can download a free trial of the very latest full RAD Studio C++ Builder version.
C++ Builder is the easiest and fastest C and C++ IDE for building everything from simple to professional applications on the Windows, MacOS, iOS & Android operating systems. It is also easy for beginners to learn with its wide range of samples, tutorials, help files, and LSP support for code. RAD Studio’s C++ Builder version comes with the award-winning VCL framework for high-performance native Windows apps and the powerful FireMonkey (FMX) framework for cross-platform UIs.
There is a free C++ Builder Community Edition for students, beginners, and startups; it can be downloaded from here. For professional developers, there are Professional, Architect, or Enterprise versions of C++ Builder and there is a trial version you can download from here.