Лекции.Орг


Поиск:




Категории:

Астрономия
Биология
География
Другие языки
Интернет
Информатика
История
Культура
Литература
Логика
Математика
Медицина
Механика
Охрана труда
Педагогика
Политика
Право
Психология
Религия
Риторика
Социология
Спорт
Строительство
Технология
Транспорт
Физика
Философия
Финансы
Химия
Экология
Экономика
Электроника

 

 

 

 


Programs and programming languages




Computers can deal with different kinds of problems if they are given the right instructions for what to do. Instructions are first written in one of the high-level languages, e.g. FORTRAN, COBOL, ALGOL, PL/I, PASCAL, BASIC, or C, depending on the type of problem to be solved. A program

5 written in one of these languages is often called a source program, and it cannot be directly processed by the computer until it has been compiled, which means interpreted into machine code. Usually a single instruction written in a high-level language, when transformed into machine code, results in several instructions. Here is a brief description of some of the

io many high-level languages:

FORTRAN acronym for FORmula TRANslation. This language

is used for solving scientific and mathematical problems. It consists of algebraic formulae and English phrases. It was first introduced in the United States in 1954.

15 COBOL acronym for COmmon Business-Oriented Language. This language is used for commercial purposes. COBOL, which is written using English statements, deals with problems that do not involve a lot of mathematical calculations. It was first introduced in 1959.

ALGOL acronym for ALGOrithmic Language. Originally called IAL,

zo which means International Algebraic Language. It is used for mathematical and scientific purposes. ALGOL was first introduced in Europe in 1960.


PL/I Programming Language I. Developed in 1964 to combine

features of COBOL and ALGOL. Consequently, it is used for data processing 25 as well as scientific applications.

BASIC acronym for Beginner's All-purpose Symbolic Instruction

Code. Developed in 1965 at Dartmouth College in the United States for use

by students who require a simple language to begin programming.

C developed in the 19 70s to support the UNIX operating system. C is a 30 highly portable general-purpose language.

Other such languages are APL (developed in 1962), PASCAL (named after Blaise Pascal and developed in 1971), and LISP and PROLOG, both of which are used for work in artificial intelligence. LOGO is a development of LISP which has been used to develop computer-based training (CBT)

35 packages.

When a program written in one of these high-level languages is designed to do a specific type of work such as calculate a company's payroll or calculate the stress factor on a roof, it is called an applications program. Institutions either purchase these programs as packages or commission

40 their own programmers to write them to meet the specifications of the users.

The program produced after the source program has been converted into machine code is referred to as an object program or object module. This is done by a computer program called the compiler, which is unique for each

45 computer. Consequently, a computer needs its own compiler for the various high-level languages if it is expected to accept programs written in those languages. For example, in order that an IBM RS/6000 may process a program in FORTRAN, it needs to have a compiler that would understand that particular model and the FORTRAN language as well.

50 The compiler is a systems program which may be written in any language, but the computer's operating system is a true systems program which controls the central processing unit (CPU), the input, the output, and the

secondary memory devices. Another systems program is the linkage editor, which fetches required systems routines and links them to the

55 object module (the source program in machine code). The resulting program is then called the load module, which is the program directly executable by the computer. Although systems programs are part of the software, they are usually provided by the manufacturer of the machine.

Unlike systems programs, software packages are sold by various vendors

60 and not necessarily by the computer manufacturer. They are a set of programs designed to perform certain applications which conform to the

particular specifications of the user. Payroll is an example of such a package which allows the user to input data — hours worked, pay rates, special deductions, names of employees — and get salary calculations as

65 output. These packages are coded in machine language (Os and 1s) on magnetic tapes or disks which can be purchased, leased, or rented by users who choose the package that most closely corresponds to their needs. ■

Vocabulary

payroll (1. 62) — list of employees and the amount of money to be paid to each of them


Task 3 These are answers to questions about the text. Write the questions.

1 No, it is quite wordy so it is used for commercial purposes.

2 To support the UNIX operating system.

3 An applications program.

4 It is done by the compiler.

5 It fetches required systems routines and links them to the object module.

6 No, they are also sold by other vendors.

Task 4 Summarize the information on different high-level computer languages by

completing the table below.

Language Developed Function Characteristic
FORTRAN      
       
    mathematical and scientific purposes  
      combines features of COBOL and ALGOL
BASIC      
    to support Unix operating system  
       
       

 

  Find the passages in the text where the following ideas are expressed. Give the line references. line
Task 5
  1. _ Systems programs control the work of the computer system.
  1. Software packages are not always sold by the manufacturer.
    Usually, every high-level instruction translates into many more in machine code.
  1. Systems programs are usually provided by the manufacturer.
  1. Programmers may be required to write software for their employers.

Task 6 Using the line reference given, look back in the text and find the reference for the words in italics. 1 if they are given the right (line 1) 2 it cannot be directly processed (line 5) 3 it is called an applications program (line 38) 4commission their own programmers (line 40) 5to write them to meet (line 40) 6 that would understand (line 48) 7 which controls the central (line 51) 8links them to the object (line 54) 9 They are a set of programs (line 60) 10 which can be purchased (line 66)

 


Task 7 Using the line references given, refer back to the text and find words or phrases that have a similar meaning to: 1 converted (lines 5-10) 2give the responsibility to (lines 35-40) 3brings (lines 50-55) 4are compatible with (lines 60-65) 5matches (lines 65-67)

 

Task 8 Choose the correct word to complete each sentence. You may have to change

some words slightly.

1 instruction, instruct, instructed, instructor

aOur maths arithmetic. bWe were_______________ c Both__________________         explained to us the principles of binary
       
      to document our programs very carefully. and data have to be changed to machine code before
     
     

 

the computer can operate on them.

2 compilation, compiler, compile, compiled

a Our university computer does not have a PASCAL___________

b Usually, a programmer ________ his program before he puts in the
data.

c A source program cannot be directly processed by the computer until it has been

3 result, results, resulting

a The linkage editor links systems routines to the object module. The
__________ program, referred to as the load module, is directly
executable by the computer.

b The___________ of these mathematical operations were obtained from

the university mainframe and not from my micro.


4 specification, specify, specific, specified, specifically

a Our company bought three packages with very ___________ applications:

payroll, accounts receivable, and accounts payable.

b An applications program is designed to do a type of work,

such as calculating the stress factor of a roof.

c Did the analyst give the new programmer the necessary to

start on the project?

C language

Listening

Listen this terview with David Wendt, an expert on C. Are the following

sentences true (T) or false (F)?

C was written to support the development of the MS/DOS operating system.

C was based directly on a language called BCPL.

UNIX was rewritten in C in 1973.

C is rarely used for systems programming now.

C's main disadvantage is that it has a small set of operators. C is more powerful than Assembler.

C can be used to access memory addresses directly. Pascal and C produce equally fast and efficient code. C is the ideal language for everyone.

A language called D is expected to replace C.

Listen again. Change the sentences that are false to make them true.


Task 10 Listen again to the cassette and fill in the gaps in the tapescript below.

INTERVIEWER: Could you give some examples of how it does that?

DAVID WENDT: Yes. With C, the programmer can access the underlying hardware. He can access memory addresses directly, he can perform operations on values stored as _________________________________, and he can store variables in
registers, just as in Assembler. This produces faster and more

code than is produced by high-level languages like PASCAL. At the same time, it provides the fundamental 3 constructs required
for well-structured programs: decision-making, loops, and

These features combined together provide a very powerful tool for the programmer.

INTERVIEWER: You make it sound like the ideal language for everyone.

DAVID WENDT: Well, no, I'm not saying that. But if you need to write programs

that are 6, fast in execution, and yet 7 from one

computer to another, then C is the language you should be using.

Reading

Task 11 Read the program below and the text on the next page, then complete the

sentences which follow.

/* CALCULATE AVERAGES */ main()

f

float a,b,c,d,average; printf("Enter three numbers:");

scanf("%f %f %f",&a,&b,&c); d=a+b+c;

average=d/3.0;

printf("The average is %f", average);


Comment Lines

A C source program consists of statements and comment lines. Comment lines are enclosed by the characters /* (at the start of the comment) and */ (at the end of the comment).

The Function main{ }

Every C program must have a function called main which must appear

5 only once in a program. The parentheses following the word main must be present, but there must be no parameters included. The main part of the program is enclosed within braces {}, and consists of declaration statements, assignment statements, and other C functions. In the above

program there are six statements within the braces: a declaration

10 statement (the first statement of the main program starting with the word float), two assignment statements (the fourth and fifth statements starting with the variable names d and average), and three function statements, two to print information on the screen and one to scan the keyboard for input.

15 As C is a free form language, the semicolon (;) at the end of each line is a

must. It acts as a statement terminator, telling the compiler where an instruction ends. Free form means that statements can be identified and

blank lines inserted in the source file to improve readability, and statements can span several lines. However, each statement must be

20 terminated with a semicolon. If you forget to include the semicolon, the compiler will produce an error, indicating the next line as the source of the error. This can cause some confusion, as the statement objected to can be correct, yet as a syntax error is produced.





Поделиться с друзьями:


Дата добавления: 2016-11-23; Мы поможем в написании ваших работ!; просмотров: 4336 | Нарушение авторских прав


Поиск на сайте:

Лучшие изречения:

Надо любить жизнь больше, чем смысл жизни. © Федор Достоевский
==> читать все изречения...

2298 - | 1984 -


© 2015-2024 lektsii.org - Контакты - Последнее добавление

Ген: 0.008 с.