C++ is one of the most powerful programming languages and it’s suitable for a wide variety of uses. The RAD Studio, C++ Builder IDE is a simple development tool for those who want to develop C++ applications. Using a fast and reliable C++ IDE is very important for beginners and professionals it is also important which language features exist, how to use them, how to start and end the program professionally. If you want to jump to C or C++ programming, please just download the latest C++ Builder to learn C++ easily and develop amazing C++ applications. In this article we have C++ substring example that uses substr
method and demonstrates how to end a C++ program.
The free version of C++ Builder CE is also great for beginners. If you want to develop professionally it is highly recommended that you start with C++ Builder CE version. Today we have a great selection to choose from when looking for a free C++ IDE. Tools like C++ Builder CE, Dev-C++, and even the BCC32 command line compiler.
Table of Contents
How to end a C++ program?
In C and C++ programs we use return
to exit a program. If you are a beginner, then “Hello World” examples are a good way to understand features of the programming language. It is good to understand how to edit text, how to write in its format, how to compile and link, how to debug and execute, how to deploy or release. This full example below is a “Hello World” C example that can be run with C++ Builder.
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 substr example below that can be run with C++ Builder as a C++ Console Application.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
#include <iostream> #include <string> int main() { std::string s1, s2; s1 = "LearnCPlusPlus.org"; s2 = s1.substr( 0 , 6 ); std::cout << "The first substring is: " << s2 << std::endl; s2 = s1.substr( 5 , 9 ); std::cout << "The second substring is: " << s2 << std::endl; getchar(); return 0; } |
As you see we used return 0 to end our C++ code. If you want to show the exit value in terms of coding, there are two definitions, EXIT_SUCCESS
and EXIT_FAILURE
are defined in stdlib.h
. Include stdlib.h then you can exit successfully from your app as below,
1 |
return EXIT_SUCCESS; |
If this is about failure of your program then you can exit from your app as below,
1 |
return EXIT_FAILURE; |
for example we can use this as below
1 2 3 4 5 6 7 8 9 |
#include <iostream> int main() { std::cout << "Hello LearnCPlusPlus\n"; getchar(); return EXIT_SUCCESS; } |
How to run and end a C++ program in C++ Builder ?
You can edit and run C or C++ code using C++ Builder. C++ Builder is a modern powerful C++ IDE. It has C and C++ compilers allowing you to carry out any variety of professional quality development. C++ Builder has a free C++ Builder Community Edition. There is also a paid C++ Builder Professional / Architect / Enterprise version too.
1. Download the free C++ Builder Community Edition and install it.
2. In C++ Builder, create a new console application from the File->New->Console Application – C++ Builder menu . Chose C++ Language as a Source Type and Target Framework as None from the next window and press OK. ,
You can write the C++ code shown above into the C++ Builder code editor or you can copy and paste it. If you are a beginner, we highly recommend you to write the code yourself. This will help you to understand how C++ works and you can see your first mistakes when you are coding.
How to compile, run and end a C++ program with a C++ IDE?
In C++ Builder you can simply press Run Button (without debugging or with debugging) or F9 key to compile and run your code, or you can use Run Menu to compile and run too.
How to compile, run and end a professional C++ program with RAD Studio?
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.
Download RAD Studio 11 Now
See What’s New in RAD Studio 11
Design. Code. Compile. Deploy.
Start Free Trial
Free C++Builder Community Edition