How To Write C++ Program?

How To Write C++ Program?

The source code of a C++ program is stored on the disk with file extension cpp. (cpp stands for c plus plus). The program is stored in a text file on the disk. Any text editor can be used to write and edit C++ source code.


The Borland C++ and Turbo C++ have their own editors for writing the source code. The source code is written in the editor and then it is compiled.

The C++ compiler translates a C++ source program into the machine code. The machine code is called object code. It is stored in a new file with extension obj. The object code is then linked to the libraries. After linking the object code to the libraries , an executable file with extension exe is created. The executable program is then run from operating system command line.

For example, a source code of a program in C++ is written and stored in file first.cpp. After compilation , the object code is saved in file first.obj  and the executable code is stored in file first.exe.
Creative Commons License
Pakistan How by Tahira Aijaz is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.