Introduction to Programming and C++

Contents No Previous Topic Next Topic

By now, you have heard the speed of a processor, or central processing unit (CPU), referred in terms of hertz, usually in gigahertz, or billions of cycles per second. With each cycle, a CPU is able to execute one instruction. Any executable program is a sequence of instructions to the CPU.

While it is entirely possible to write an executable program in these instructions, this is useful for only the lowest-level programs (e.g., operating systems and video drivers). Usually, you will write a source file (a text file) in a higher-level language, such as C++, Java, or C#, after which you attempt to convert it into instructions which the CPU can interpret. This process is called compilation: you are compiling a sequence of machine instructions. This is where yet another program (a compiler) attempts to take your source file, interpret it, and convert it into a sequence of instructions which the CPU on your computer will be able to execute.

This is usually within an integrated development environment (IDE) which simplifies many of the common tasks associated with programming.

From within an IDE, it is possible to immediately execute the executable program compiled from your source file, however, in reality, somewhere on your hard drive is an executable file which, if you entered a Command Prompt, you could run by simply typing the name of the file at the prompt. In Windows, these executables end in the .exe extension.

A programming language is a way of telling a particular compiler what it is you want the CPU to do. In order to avoid any chance of mistake due to misinterpretation, there is a very strict format to each programming language. If you do not follow this format, the compiler will not understand your source code and will issue an error. This means that no executable program has been built. You must go back, correct your mistake, and try to compile the program again.

This series of lessons begins by giving you source code which is known to work. The functionality is described and you are able to compile the source code into executable programs and run those programs. As the lessons progress, you will also be challenged to write your own programs in C++.


Contents No Previous Topic Top Next Topic