C++C++11C++14C++17Introduction to C++Learn C++

How To Terminate C++ Program

How To Terminate C++ Program

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 powerful yet easy to use 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 Learn C++ language, first just download the latest C++ Builder professional edition or free C++ Builder CE edition and develop amazing C++ applications. In this article we have C++ examples that demonstrates how to terminate a C++ program.

How to terminate a C++ program in Terminal when running?

  • If you run your C or C++ app in Command Prompt, and it is in loop or you want to end this running program, just press Ctrl+C to end the app. This is default in Windows and Linux console apps, in addition Mac-OS console apps too.
  • If you are running C or C++ app in the C++ IDE, there is a STOP button to stop the application from running. You can use the PAUSE button to Pause and continue too.
  • In Windows, if you are not able to end your C++ application, the last chance is to use Task Manager. Right-click on the taskbar – or Start button in Windows 11 and then choose Task Manager. In the Task Manager, find your C++ app listed and right-click on it then select “end task”.

How to develop and terminate a C++ program in development?

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.

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,

If this is about failure of your program then you can exit from your app as below,

for example we can use this as below

How to run and terminate 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. ,

How To Terminate C++ Program- the C++ IDE
The RAD Studio, C++ Builder Welcome Screen

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 terminate 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 Terminate C++ Program? The Run with or without debugging buttons

In Debugging mode, there is a “Run->Program Reset” menu, or you can use Program Reset (Stop) button to stop running application in debug mode or you can use Ctrl+F2 to terminate your C++ program. If you want you can pause your application in some step then you can continue too.

How to compile, run and terminate 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.

How To Terminate C++ Program - the C++ Builder logo

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

close

Oh hi there 👋
It’s nice to meet you.

Sign up to receive awesome C++ content in your inbox, every day.

We don’t spam! Read our privacy policy for more info.

About author

Dr. Yilmaz Yoru has 33+ years of coding with more than 30+ programming languages, mostly C++ on Windows, Android, Mac-OS, iOS, Linux, and some other operating systems. He was born in 1974, Eskisehir-Turkey, started coding in college and graduated from the department of Mechanical Engineering of Eskisehir Osmangazi University in 1997. He worked as a research assistant at the same university for more than 10 years. He received his MSc and PhD degrees from the same department at the same university. Since 2012, he is the founder and CEO of Esenja LLC Company. He has married and he is a father of a son. Some of his interests are Programming, Thermodynamics, Fluid Mechanics, Artificial Intelligence, 2D & 3D Designs, and high-end innovations.
Related posts
C++C++11C++14C++17Learn C++Templates

Learn How To Eliminate Pointers In Templates in C++

C++C++11C++14C++17Learn C++Templates

Learn To Export And Import Template Members From A DLL Or A Package In C++

C++C++11C++14C++17Learn C++Templates

What Is A Function Template In C++?

C++C++11C++14C++17Learn C++Templates

What Is A Class Template In C++?