Learn C++

How To Start A C++ Program

How To Start A C++ Program

How to start designing. creating, compiling and launching a C++ program is at once, paradoxically, both easy and difficult. There is a great quote from the Dao De Jing which says, “a journey of a thousand miles starts with a single step“. I would augment that by adding “start with the right first step“.

Using a fast and reliable C++ compiler for Windows is a very important ‘right first step’ for beginners and professionals since it helps C/C++ developers in remembering which language features exist, how to use them, and even detect errors when we get them wrong. The C++ language is extremely popular among developers for all sorts of applications ranging from simple business apps to games and even operating systems.

This article looks into what those first steps are and the kind of things to consider on the journey to designing and creating your first C++ program.

292669203 10159281964412499 2865954964395779081 n 2548541

How to start a C++ program in your mind?

The first step of the creativity is developing empathy with other users and the devices they may use. Think about yourself as a user and what you might need? Think about other users; kids, adults, elderly people, people with differing physical and mental abilities; what might they need, think about their country, how might its culture, conditions and needs inform your design decisions? What kind app can be helpful for these people? Maybe you should talk with them to research their needs firsthand.

Consider their physical futures too; big fingers/hands, small fingers/hands on mobiles, the ability for the user of kiosk apps to reach certain parts of the screen which could be impacted either by their height or by factors such as being in a wheelchair or similar alternate set of external conditions. In some countries and territories, accessibility (which is what we are describing) is not only a desired trait for your apps and programs – but it may also be a legal requirement. Even if you have considered accessibility don’t forget to take into account things like the type of clothing and safety equipment a user might be wearing: skiers may be wearing thick clothing and gloves, drivers and manual workers could be in a noisy environment or one where they cannot look at the device’s screen for safety reasons – does this mean your app should act differently?

How to start a C++ program with flow charts?

Now you have the needs and an idea of potential areas of focus you might find it useful to plan out a “user story”. Put simply this is a set of descriptions of actions which your user might take in using your app. For interactions which have a clear set of steps and decisions a flow chart might be helpful. Don’t worry if you don’t think you’re up to drawing actual flowcharts – try writing out the steps and simple connected sentences. For example: Start App –> Get Username and Last name-> Get User Birthday -> Check data is valid->Save Data -> Stop App.

How to start a C++ program in design?

What kind of Forms should be in your app? For example, do you need a login form, a main form where the data is displayed, an editing form, and perhaps a settings form. What text should be displayed, which buttons should you use? If your app is going to be used in more than one country, have you allowed enough room for the text when it is displayed in German, for example? What about for languages which read right to left such as Arabic, how would your screen design change, if at all?

You can use drawing sketch on paper, or some physical items in this process. Most developers use digital drawing or design apps, sometimes referred to wireframes or mock-up apps. Professional developers use specialized developer apps with extensive design features. For example, RAD Studio / C++ Builder has great design features, you can easily drag and drop buttons, text, images and lots of other controls. So, you can see the final results on design time and run time easily.

How to start a C++ program by coding it with C++ Builder

You can start writing C or C++ code by the C++ compilers and build tools like C++ Builder. C++ Builder has free C++ Builder Community Edition and C++ Builder Professional / Architect / Enterprise versions.

1. Download 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 pres OK. ,

If you are new to programming, here is a quick introduction on how to create a simple C Program. C Programs (C code) is a simple text file, which means you can use any editor to edit these kinds of programs. Notepad, Notepad++. But C++ IDE’s have more features to edit and run C Programs. Like Dev-C++, RAD Studio, C++ Builder, etc. Before you do anything though, you should download and install a free C and C++ compiler and IDE. Then run your IDE, now you can write your C codes here to begin.

When you start coding, first of all, you should include libraries that you intend to use. Generally, for beginners stdio.h library is enough to do simple beginner apps. We can include this library as below,

Second, you should add the main procedure (the main program, the main function) as below,

After that you should write your programming code lines into this procedure, between { and } brackets. If you are a beginner “Hello World” examples are good to understand feature of that 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.

In C++, after every command you use you should put ; to the end of your commands. 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 std::cout 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 run and exit.

3. You can simply press Run Button or F9 key to compile and run, or you can use Menu to compile and Run too.

4. If you want to run this program in Console then execute RAD Studio Command Prompt from the Windows menu in Windows. This will open Command Console (Terminal) with RAD Studio / C++ Builder configs. After this step, in Terminal, go to folder of your C file and type bcc32 and your file name. For example you can compile your app as below,

To run your compiled app you can type compiled excitable file name which has .exe extension of you C file. For example to run compiled myapp.c file write its executable output as below,

How to run a C program in terminal with a free C++ compiler?

There are different Embarcadero C++ Compilers for different usage. These are bcc, bcc32c, bcc32x, bccaarm, bcc64 executable compilers. developed 2012-2022 Embarcadero Technologies, Inc. There is a free Win32 compiler officially listed as a free C++ Compiler in the Official Web Page of Embarcadero.

bcc32c 760 3380590

This free download of the C++ Compiler includes C11 language support, the Dinkumware STL (Standard Template Library) framework, and the complete Embarcadero C/C++ Runtime Library (RTL). In this free version, you’ll also find a number of C/C++ command line tools—such as the high-performance linker and resource compiler.

The Free C++ Compiler download includes:

  • Embarcadero C++ Compiler (bcc32c/bcc32x)
  • Turbo Incremental Linker (tlink32)
  • C++ Win32 Preprocessor (cpp32)
  • Import Library utility—for creating import libraries from DLLs (implib)
  • Librarian for symbol case-conversion, creating extended libraries and modifying page size (tlib)
  • Other useful command-line utilities such as make, grep, and touch
  • Includes the Embarcadero C/C++ Runtime Library, and the DinkumwareANSI/ISO Standard Template Library (STL)

C++Builder includes compilers for Win32, Win64 and iOS. And, C++Builder also features a modern, high-productivity RAD Studio IDE, debugger tools, and enterprise connectivity for to accelerate cross-platform UI development. Learn more about RAD Studio on its product page.

To execute a C program in terminal,

You can use one of these C++ compilers to compile C programs in terminal. For example, if your C program file is myproject.c you can compile this with optimization level 2 (-o2) as below,

How to run C program in terminal with the GNU C/C++ compiler?

GNU GCC is another powerful C/C++ compiler originally written as the compiler for the Unix, Linux and GNU operating system. The GNU system was developed to be 100% free software, and it is efficient with both 32-bit and 64-bit operations. This compiler can be used on Windows using MinGW or CygWin Linux Simulators. Compiled executable files need a small dll to run independently on Windows. It is mostly compatible with CLANG standards.

GCC Compiler can be used by Visual Studio Code, Dev C++, Code Blocks, and can be directly used with Command Prompt or PowerShell. It is available on the official product page https://gcc.gnu.org/.

GNU C/C++ compilers can be directly used in Linux or it can be used with MinGW Linux Simulation (with GNU C/C++ Compiler) to develop C++ applications running on the command console. It is the most well-known compiler in Linux.

How to execute a C program in Linux terminal?

In Linux, GNU C/C++ comes as default language installed. Generally gcc compiler is used as a C compiler and g++ compiler is used as C++ compiler. If your c program file is myapp.c you can compile this with g++ compiler as below,

Be sure that you have permission to write to folder there. Now you can easily run your myapp.out as given below,

Here is the full input and output process in Linux terminal

How to run a C program in terminal with a professional C++ compiler?

cbuider studio final icons 64 9744851 4964591 6127446 4112068 5843153

In general, you can run c programs with the latest C++ Compilers and Editors today. C++ Builder Professional, Enterprise and Architect Editions are able to run C programs. There is a free C++ Builder Community Edition for students, beginners, and startups too. Simply you can download, install and run your C programs in console applications. Moreover you can enhance your C programs with C++ features and modern GUIs, which means you can mix and use C and C++ together. For the best modern app, later if you wish, you can update your C program to a C++ program.

C++ Builder is the easiest and fastest C and C++ IDE for building simple or 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. C++ Builder comes with Rapid Application Development Studio, also known as RAD Studio, and C++ Builder is one of the most professional IDE’s that work under RAD Studio. It is the oldest IDE (it began as Borland TurboC in 1990). 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.

rads11 1u1light welcome 9155681
The Latest RAD Studio C++ Builder Welcome Screen

You can simply use RAD Studio Command Prompt to compile and execute C programs in terminal. For example, if your c program file is myproject.c you can compile this with optimization level 2 (-o2) as below,

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.

Download RAD Studio 11 Now

See What’s New in RAD Studio 11

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.

Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial

Free C++Builder Community Edition

About author

Dr. Yilmaz Yoru has 35+ years of coding with more than 30+ programming languages, mostly C++ on Windows, Android, Mac-OS, iOS, Linux, and some other operating systems. He graduated and received his MSc and PhD degrees from the Department of Mechanical Engineering of Eskisehir Osmangazi University. He is the founder and CEO of ESENJA LLC Company. His interests are Programming, Thermodynamics, Fluid Mechanics, Artificial Intelligence, 2D & 3D Designs, and high-end innovations.
Related posts
C++C++11C++14Learn C++Syntax

How To Convert u32string To A wstring In C++

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

How To Learn The Move Constructors In Modern C++?

C++C++17Code SnippetLearn C++

How To Convert Char Array String To Unicode String Correctly In C++?

Artificial Intelligence TechC++Language FeatureLearn C++

How To Develop A Simple Hopfield Network In C++