Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Тексты по английскому языку.doc
Скачиваний:
41
Добавлен:
01.04.2015
Размер:
302.08 Кб
Скачать

Text 20 high level programming languages fortran

A high level language is a language in which each instruction or statement correspond to several machine code instructions. It is contrasted with a low level language in which each instruction has a single corresponding machine code equivalent. High level languages allow users to write in a notation with which they are familiar, e.g., FORTRAN in mathematical notation, COBOL in English. So, high level languages are oriented to the problem, while low level languages are oriented to the machine code of a computer.

FORTRAN. FORTRAN is an acronym for FORmula TRANslation. It is a problem oriented high level programming language for scientific and mathematical use, in which the source program is written using a combination of algebraic formulae and English statements of a standard but readable form. FORTRAN was the first high level programming language. It was developed in 1954, and was designed to easily express mathematical formulas for computer processing. It is still the most widely used programming language. There were several versions of FORTRAN. The most popular and used was FORTRAN-4.

A FORTRAN program consists of data items, executable statements and non-executable statements. The program is structured in segments which consist of a master segment and optional function segments and subroutines.

Data items in FORTRAN are either variables or constants, and are assigned alphanumeric names by the programmer. Group of similar items of data can be processed as arrays, or tables of data, in which case the individual items are defined by one or more subscripts.

Data items in high level languages may take the following forms:

Integer is a whole number value falling within a range determined by the capacity of the computer being used.

Real is a number expressed in floating-point representation accurate to a number of significant digits, the range again depends on the capabilities of the particular machine being used.

Complex is a number in which two real numbers are used to express the real and imaginary parts.

Logical is a quantity which can only take two values, true or false.

Text is character information, which is not used for mathematical operations.

The actual operations of the program are expressed by means of ‘executable statements’. These can take two forms: ‘assignment statement’ and ‘control statements’. An assigned statement takes the form Variable = Expression. The expression may be either arithmetic or logical. An arithmetic expression can include variables, elements, form arrays, constants and a variety of standard functions which are combined by arithmetic operations, e.g., +, -, * (multiplication), / (division), ** (exponentiation). A logical expression is similar but include the operations AND, NOT, OR, etc, and the logical operators.

Text 21 The elements of programming

Most programs are designed to solve a problem. They solve problems by manipulating information or data. As a programmer you do the following:

  • get the information into the program — input.

  • have a place to keep it — data.

  • give the right instructions to manipulate the data— operations.

  • be able to get the data back out of the program to the user (you, usually) — output.

You can organize your instructions so that

  • some are executed only when a specific condition (or set of conditions) is True — conditional execution.

  • others are repeated a number of times — loops.

  • others are broken off into chunks that can be executed at different locations in your program — subroutines.

These are the seven basic elements of programming: input, data, operations, output, conditional execution, loops, and subroutines. This list is not comprehensive, but it does describe those elements that programs (and programming languages) usually have in common. Many programming languages, including Pascal, have additional features. And when you want to learn a new language quickly, you can find out how that language implements these seven elements, and then build from there. Here's a brief description of each element:

Input. This means reading values in from the keyboard, from a disk, or from an I/O port.

Data. These are constants, variables, and structures, that contain numbers (integer and real), text (characters and strings), or addresses (of variables and structures).

Operations. These assign one value to another, combine values (add, divide, and so forth), and compare values (equal, not equal, and so on).

Output. This means writing information to the screen, to a disk, or to an I/O port.

Conditional execution. This refers to executing a set of instructions if a specified condition is True (and skipping them or executing a different set if it is False) or if a data item has a specified value or range of values.

Loops. These execute a set of instructions some fixed number of times, while some condition is True or until some condition is True.

Subroutines. These are separately named sets of instructions that can be executed anywhere in the program just by referencing the name.