The human-readable version of a program created in a high-level language by a programmer is called:

Previous lesson Next lesson

When you execute [or open or run] an application either on your desktop computer, laptop or smart phone, the computer begins to perform operations behind the scene. The operations that a computer can perform include storing, accessing and manipulating [or processing] information, or data [specifically, numbers]. At some point, however, for this to happen, a developer [or programmer] had to specify what operations the computer should perform.

The problem with a computer is that it "speaks" in a binary numbering system [that is, processing using only zeros and ones] and while some people have learned such languages [indeed, someone had to design such languages], the dedication required exceeds the efforts most humans are willing to put towards such an endeavour. We call this language of the computer machine language and the machine language of one processor like the Intel Core i7 is different from that of another processor like the ARM Cortex M3.

Definition: binary numbering system
Counting and performing other instructions using only zeros and ones—more on this later. This is often simply abbreviated to just binary; however, the word "binary" is often used as an adjective to describe two parts or components.

Definition: machine language
The binary instructions that a computer understands and allows the computer to carry out tasks specified by the programmer.

You will learn more about machine language in your course on digital computers.

There is a human-readable version of machine instructions that is called assembly language; however, you will also see this in your course on digital computers. Throughout this course, on occasion, we will present a simplified assembly language where we demonstrate what happens when code is executed on a computer.

For most humans who program computers, we use high-level programming languages to author programs to be executed by a computer. A high-level language is closer to the language you use in your mathematics class, and you can already read such expressions, but unlike mathematics, almost all programming languages are simply a sequence of letters, numbers or symbols, all of which are found on a standard keyboard. Numbers can be either integers [3, 7, 5, -182 and 0] or reals [3.252, -2.5932 and 3.141592654] and operations like addition, subtraction and division use +, - and /, respectively. Multiplication is usually represented by an asterisks, or *. There is no division symbol [$\div$] on a standard keyboard, so we cannot use such symbols in programming. Similarly, we cannot write $n \choose k$, or $|x|$, so we will have to deviate from standard mathematical notation. Some examples of expressions in mathematics and their equivalent in C++ are shown in Table 1.

Table 1. Mathematical expressions in English, mathematical notation and the C++ programming language.

Expressed formWritten formProgramming form
"Add $m$ and $n$ and multiply the sum by two." $2[x + y]$ or
$2 \times [x + y]$
2*[x + y]
"$n$ cubed over three" $n^3/3$ or $\frac{n^3}{3}$ [n*n*n]/3
"After $s$ seconds, the ball has dropped one-half 9.8 $s$ squared metres plus $s$ times the initial velocity downward." $\frac{1}{2}9.8s^2 + s v_0$ or
$0.5\cdot9.8s^2 + s v_0$
0.5*9.8*s*s + s*v0

Initially, you will see one weakness: if you want to calculate $x^5$, you must write x*x*x*x*x. We will deal with this weakness later; however, for right now, we will point out that calculating higher exponents isn't performed nearly as often as the other arithmetic operations of +, -, * and /.

We will learn such a high-level programming language. Each file will contain one program, and we will refer to that program as your source code. Another program, called a compiler, will translate your source code into machine language.

Definition: high-level programming language
A human-readable [and therefore human-writable] language that allows a human to more easily specify the operations that a computer is to perform.

Definition: source code
Human-readable program instructions written in a high-level programming language stored in a text file or files. These instructions cannot be executed by a computer and need to be compiled into machine instructions to create an executable program.

Definition: compiler
A program that takes source code written in a high-level programming language and translates it into machine language.

Before we go any further, let's actually look at a program:

#include int main[]; int main[] { std::cout

Chủ Đề