Why C++?
C++ is an advanced, powerful Computer Programming language, yet it is relatively easy to introduce and learn. it is most modern, high-performance computer programs are written using C++. |
|
C++ knows about objects and therefore can teach sound programming techniques from the very beginning. |
|
C++ is a compiled computer language. This means the original source code is translated into a specific machine’s native tongue, all at once, before the program is run. |
|
The program the computer runs is composed entirely of instructions known to it, requiring no further interpretation. |
|
Below a picture has been given to understand so how c++ source code translate into machine code: |
|
|
Source Code |
|
#include |
|
int main() |
|
{ |
cout << “Bonjour Monde!” << endl; |
return 0; |
} |
|
|
|
Compiler |
|
A compiler is a very specialized computer program that translates source code into machine-specific code. |
|
Compiler writing is very difficult and esoteric and is one of the more advanced and complex parts of computer science. |
|
It is not too much to say that a compiler writer is to a computer programmer as a computer programmer is to someone who thinks they speak Latin in Latin America. |
|
|
F000:0000 |
F0 |
LOCK |
|
F000:0001 |
8AC4 |
MOV |
AL,AH |
F000:0003 |
9A5CF000F0 |
CALL |
F000:F05C |
F000:0008 |
EBEA |
JMP |
FFF4 |
F000:000A |
8AC2 |
MOV |
AL,DL |
F000:000C |
02C6 |
ADD |
AL,DH |
F000:000E |
52 |
PUSH |
DX |
F000:000F |
BA8103 |
MOV |
DX,0381 |
F000:0012 |
9AD44500F0 |
CALL |
F000:45D4 |
F000:0017 |
5A |
POP |
DX |
F000:0018 |
5A |
POP |
DX |
F000:0019 |
59 |
POP |
CX |
F000:001A |
58 |
POP |
AX |
F000:001B |
CB |
RETF |
|
F000:001C |
56 |
PUSH |
SI |
F000:001D |
D000 |
ROL |
BYTE PTR [BX+SI],1 |
F000:001F |
F0 |
LOCK |
|
F000:0020 |
82D000 |
ADC |
AL,00 |
|
|
|
|
Note This code only show how the program of c++ language converted into machine language. |
|
The other major approach to running a computer program is called interpretation. An interpreter converts a computer program into the host machine’s native tongue, instruction by instruction, as the program runs. |
|
This is a nice environment in which to write programs, but if the program is simply used and is no longer being developed, much time is wasted re-interpreting instructions that could be translated just once and stored in translated form. |
|
Because a compiler translates the entire program at once, compiled programs are faster than interpreted programs, and are preferred for tasks that require high performance. |
|
There are two principal reasons for high-level languages like C++. |
|
The first is to make program development easier each instruction written in C++ might represent dozens or hundreds of lower-level native instructions. |
|
The second is to make programs portable if sufficient care is taken in development, a program written for one computer can be re-compiled and run on another. |
|
Therefore, a programmer need only learn one computer language, instead of one language per computer architecture. |
|
If a single program can be run on any machine, the unit price of software can go down. It would be nice if there were an interpreted version of C++, for program development work only, so the developer would not have to re-compile after each trivial change. |
|
But this hasn’t happened yet, and in any case, it would probably be an expensive environment. |
|
C++ is a third generation programming language. When computers were first invented, they were programmed with very simple, low-level commands. |
|
A programmer would design a program, then translate the program into a specific set of codes, known as machine language. |
|
These codes would be fed into a computer with switches, punch-cards, or primitive keypads. |
|
These programs were cumbersome to write, and very hard to debug (Debugging is the act of removing mistakes in a program). Machine code is considered the first generation of programming languages. |
|
Third generation languages are compiled languages. These languages are not processor-specific. |
|
In theory, a program written in a third generation language will be able to run on any other machine. This is not always the case, due to a number of factors. |
|
Third generation languages are much more abstract than assembly languages. Third generation languages are translated into assembly language by a complicated piece of software called a compiler. A compiler can be thought of a language translator. |
|
|
|
C++ is a very useful language, because it gives the programmer a lot of control, but also is abstract enough so development can be done fairly quickly. |
|
C++ is a very portable language as well, because it is a third-generation language, and because it has a well-defined set of standards written for it. |
|
C++ is widely used for program development under a variety of operating systems. Good C++ programmers are in high demand today. |