Студопедия

КАТЕГОРИИ:


Архитектура-(3434)Астрономия-(809)Биология-(7483)Биотехнологии-(1457)Военное дело-(14632)Высокие технологии-(1363)География-(913)Геология-(1438)Государство-(451)Демография-(1065)Дом-(47672)Журналистика и СМИ-(912)Изобретательство-(14524)Иностранные языки-(4268)Информатика-(17799)Искусство-(1338)История-(13644)Компьютеры-(11121)Косметика-(55)Кулинария-(373)Культура-(8427)Лингвистика-(374)Литература-(1642)Маркетинг-(23702)Математика-(16968)Машиностроение-(1700)Медицина-(12668)Менеджмент-(24684)Механика-(15423)Науковедение-(506)Образование-(11852)Охрана труда-(3308)Педагогика-(5571)Полиграфия-(1312)Политика-(7869)Право-(5454)Приборостроение-(1369)Программирование-(2801)Производство-(97182)Промышленность-(8706)Психология-(18388)Религия-(3217)Связь-(10668)Сельское хозяйство-(299)Социология-(6455)Спорт-(42831)Строительство-(4793)Торговля-(5050)Транспорт-(2929)Туризм-(1568)Физика-(3942)Философия-(17015)Финансы-(26596)Химия-(22929)Экология-(12095)Экономика-(9961)Электроника-(8441)Электротехника-(4623)Энергетика-(12629)Юриспруденция-(1492)Ядерная техника-(1748)

The elements of programming




Read and speak about the elements of programming.

Speak on arithmetic and logical assignment statements in FORTRAN.

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.

UNIT XVIII

1. Read and translate the text:

HIGH LEVEL PROGRAMMING LANGUAGES BASIC & PASCAL

BASIC was developed in 1965 and stands for Beginners All-purpose Symbolic Instruction Code. It is a programming language designed for solving mathematical and business problems. BASIC was originally developed as an interactive programming language for time-sharing on large mainframes. It is widely used on all sizes of computers and has become extremely popular on microcomputers.

There are many different versions of BASIC available with limited versions running on small hand-held computers. BASIC is available in both compiler and interpreter form, the latter form being more popular and easier to use, especially for the first-time programmer. In interpreter form the language is conversational and can be used as a desk calculator. In addition, it is easy to debug a program, since each line of code can be tested one at a time.

BASIC is considered to be one of the easiest programming languages to learn. For simple problems BASIC programs can be written ‘on the fly’, at the terminal. However, complex problems require programming technique, as in any conventional programming language. Since BASIC does not require a structured programming approach, like PASCAL, and since there is no inherent documentation in the language, as in COBOL, BASIC programs can be difficult to decipher later if the program was not coherently designed.

There is no one BASIC language, but something like 90 different versions or dialects; however, all have certain common features that make it easy to use any version once the fundamentals are mastered. Since BASIC is job and human oriented, it cannot be understood by the computer as written, but must go through the intermediate step of a compiler or interpreter. As far as the programmer is concerned, it makes very little difference whether a compiler or interpreter is used.

A compiler generally used in a large computer converts the source program written in BASIC to an object program or file in machine language which is then stored in memory. In the compiler each BASIC phrase or statement is converted to one or more machine instructions. An interpreter is similar in result, but conversion is usually done while the program is running, one statement at a time. The difference between the two, which is important to the microprocessor user, is that the interpreter must be present in memory while the program is being run while the compiler can be removed once it has done its job.

One would think then that a microcomputer would most often use a compiler, but this is not the case. Since interpreter programs can be run line-by-line, they can be debugged simply rather that being recompiled for each correction, and they are more popular in small computers. In certain versions the interpreter is stored in ROM, which is less expensive than RAM, and does not need to be loaded from some external source such as a cassette.

The typical example of the algorithm in BASIC can be written as follows:

1. REM THIS PROGRAM SEARCHES A LIST AND PRINTS THE ADDRESS

10 DATA 74, 83, 66, 67, 87, 65, 84, 80, 76, 70

20 LET N =10

30 LET X =65

40 LET J =N

50 IF J = 0 GOTO 100

60 READ K

70 JF K = GOTO 100

80 LET J = J –1

90 GOTO 50

100 PRINT J

110 END

BASIC features the fact that every line is a statement and every statement must be preceded by a line number followed by space. Any statement on a line beginning with REM is ignored by the interpreter or compiler. However, these REMarks may be extremely valuable in explaining the purpose and method of the program. Some BASIC variations use the apostrophe (‘) as an abbreviation for REM.

BASIC has various expressions (constants and variables combined by arithmetic and algebraic operators), line numbers, spaces, remarks, data, and statements. BASIC statements may be: LET statement which is the simplest kind of an arithmetic assignment statement, READ statement, GOTO statement, IF THEN statement, etc. In the case of the IF statement we are interested in whether the relation between two expressions following the IF is TRUE or FALSE. In other words we are interested in the Boolean value of the expression following IF.

PASCAL. PASCAL is a general-purpose high level programming language. It is named after the famous French mathematician, Blaise Pascal, who in 1642 designed and built the first mechanical calculator, the “Pascaline”. PASCAL is noted for its simplicity and structured programming design. It is available as both a compiler and an interpreter.

PASCAL was proposed and defined in 1971, and gained popularity in universities and colleges in Europe and the United States. It was later revised and appeared as standard PASCAL in 1975. Its principal features are on teaching programming and on the efficient implementation of the language.

PASCAL may be considered a successor to ALGOL-60, from which it inherits syntactic appearances. The novelties of PASCAL lie mainly in extensive data structuring facilities such as record, set and file structures. It also affords more sophisticated control structures suitable to structured programming.

An algorithm of a computer program consists of two essential parts: a description of actions which are to be performed, and a description of the data, which are manipulated by these actions. Actions are described by statements, and data are described by declarations and definitions.

The program is divided into a heading and a body, called a block. The heading gives the program a name and lists its parameters. These are file variables and represent the arguments and results of the computation. The file output is a compulsory parameter. The block consists of six sections. They are: label declaration part, constant definition part, type definition part, variable declaration part, procedure and function declaration part, and statement part.

The first section lists all labels defined in this block. The second section introduces identifiers for constants. The third section contains type declarations, and the fourth – variable definitions. The fifth section defines procedures and functions. And the last, the sixth, gives the statements which specify the actions to be taken.

The statements used in PASCAL may be: EMPTY statement, GOTO statement, structured statement, compound statement, conditional statement, repetitive statement, WITH statement, etc.

Program structure. In Standard Pascal, programs adhere to a rigid format. You do not have to have all five declaration sections — label, const, type, var, and procedures and functions — in every program. But in standard Pascal, if they do appear, they must be in that order and each section can appear only once. The declaration section is followed by any procedures and functions you might have, then finally the main body of the program, consisting of some number of statements.

Turbo Pascal gives you tremendous flexibility in your program structure. All it requires is that your program statement (if you have one) be first and that your main program body be last. Between those two, you can have as many declaration sections as you want, in any order you want, with procedures and functions freely mixed in. But identifiers must be defined before they are used, or else a compile-time error will occur.

Procedure and function structure. As mentioned earlier, procedures and functions — known collectively as subprograms — appear anywhere before the main body of the program.

Functions look just like procedures except that a function declaration starts with a function header and ends with a data type for the return value of the function.

As you can see, there are only two differences between this and regular program structure: Procedures or functions start with a procedure or function header instead of a program header, and they end with a semicolon instead of a period. A procedure or function can have its own constants, data types, and variables, and even its own procedures and functions. What's more, all these items can only be used with the procedure or function in which they are declared.

2. Find in (b) the Russian equivalents to the following word combinations in (a):

a) 1. the Boolean value; 2. repetitive statement; 3. identifiers for constants; 4. type declaration; 5. step-by-step; 6. line-by-line; 7. hand-held computers; 8. to debug a program; 9. basic features; 10. this is not the case; 11. conditional statement; 12. general-purpose languages;

b) 1. основные особенности; 2. идентификаторы постоянных величин; 3. построчный; 4. отладить программу; 5. описание типа; 6. портативные компьютеры; 7. это не так; 9. поэтапный; 10. условный оператор; 11. универсальные языки; 12. Булево значение; оператор повторений.

3. Read and translate the verbs meaning repetition:

Retype; recompile; recycle; re-emphasize; relocate; reread; rewrite; reoccur; rearrange; reappear; replace; restart; rewind; review; return.

4. Read and translate the words meaning negotiation:

Unusual, unused; unspecified; unlimited; unsatisfactory; infrequently; unseparated; independent; indirect; indistinguishable; impossible; disadvantage; disadvantage; disjunction; decode; regardless; useless.

5. Answer the following questions:

1. What is BASIC? 2. What kinds of problems is BASIC designed for? 3. Why is the BASIC language popular on microcomputers? 4. Is it easy to debug a program written in BASIC? 5. What BASIC statements do you know? 6. What is PASCAL? 7. Who is PASCAL named after and why? 8. When did PASCAL appear as standard language? 9. How is a program in PASCAL divided? 10. How many sections does a block consist of? 11. Does PASCAL have the block structure? 12. What statements in PASCAL can you name? 13. What forms do the programs in Turbo Pascal adhere? 14. What declaration sections can appear in standard Pascal and in what order? 15. Where do procedures and functions appear in a program? 16. What are the differences between this and regular program structure?:

6. a) Compare BASIC and PASCAL;

b) Speak on the difference in BASIC and PASCAL structures.

c) Speak about the program structure of Turbo Pascal.

7. Read the following texts and render it. Write a short summary:

C LANGUAGE

Programming language С has been developed in the beginning of the seventieth years as tool means for realization of operational system UNIX on IBM PDP-11,however its popularity has quickly developed frameworks of the concrete IBM,concrete operational system and specific targets of system programming. Somewhat language С – the most universal as except for a set of the means inherent in the modern languages of programming of a high level, in it are included means for programming almost at a level of the assembler (use of indexes, bit-by-bit operations, operations of shift). The big set of operators and operations allows writing compact and effective programs. However such powerful means demand from the programmer of care, accuracy and good knowledge of language with all its advantages and lacks

As base language for С ++ language С as it, first, is flexible, compact has been chosen and has rather low level; second, approaches for programming the majority of system problems; thirdly, works everywhere and on all; and fourthly, it will be coordinated to environment programming UNIX.

One of the initial purposes of creation of language С - to replace development of programs in language of the assembler for most challenges of system programming. By development С ++ paid special attention to not lose the advantages achieved in this area. Distinction between С and С ++ first of all consists in a degree of attention to types and structures. Language С possesses significant expressive force. С ++ has still the big expressive force but to reach increase of expressiveness, the programmer should give more attention to types of objects. Knowing types of objects the compiler can correctly process expressions whereas otherwise the programmer should paint with operation with depressing details. Knowledge of types of objects also allow the compiler to find out mistakes which otherwise would not be shown before testing.

8. Read and translate the text:

History of C++

During the 60s while computers were still on early stage of development many new programming languages appeared. Among them ALGOL 60 was developed as an alternative to FORTRAN but taking from it some concepts of structured programming which would later inspire most procedural languages. ALGOL 68 also influenced directly in the development of data types in C. Nevertheless ALGOL was an unspecific language and its abstraction made it little practical to solve most commercial tasks.

In 1963 the CPL (Combined Programming language) appeared with the idea of being more specific for concrete programming tasks of that time than ALGOL or FORTRAN. Nevertheless the same definition made it a cumbersome language and therefore difficult to learn and to implement.

In 1967 Martin Richards developed the BCPL (Basic Combined Programming Language) that signified simplicity of CPL but kept the most important features the language offered although it continued to be an abstract and somewhat cumbersome language.

In 1970 Ken Thompson immersed in the development of UNIX at Bell Labs, created the В language. It was a port of BCPL for a specific machine and system (DEC PDP-7 and UNIX) and was adapted to his particular taste and necessities. The final result was an even greater simplification of CPL and it was dependent on the system. It had great limitations such as it did not compile to executable code but threaded-code, which generates slower code in execution, and therefore was inadequate for the development of an operating system. It was the reason why since 1971, Denis Ritchie, from the Bell Labs team, began the development of а В compiler which, among other things, was able to generate executable code directly. This "New B", finally called C, introduced in addition some other new concepts to the language for example, data types (char).

In 1973 Denis Ritchie had developed the bases of C. The inclusion of types its handling as well as the improvement of arrays and pointers, along with later demonstrated capacity of portability without becoming a high-level language contributed to the expansion of the С language. It was established in the book "The С Programming Language" by Brian Kernighan and Denis Ritchie known as the White Book. That served as de facto standard until the publication of formal ANSI standard (ANSI X3J11 committee) in 1989.

In 1980 Bjarne Stroustrup from Bell labs began the development of the C++ language, that would receive formally this name at the end of 1983 when its first manual was going to be published. In October 1985 the first commercial release of the language appeared as well as the first edition of the book "The C++ Programming Language" by Bjarne Stroustrup.

During the 80s the C++ language was being refined until it became a language of its own personality. In fact, the ANSI standard for the С language published in 1989 made great contributions to C++ for the structured programming.

From 1990 ANSI committee X3J16 began the development of a specific standard for C++. The period before the publication of the standard in 1998, C++ greatly developed in its use and today it is the most widely used language for developing the professional applications in all platforms.

9. Speak about the history of C++ language.

UNIT XIX

1. Read and learn the new words:

World Wide Web — всемирная паутина

recreation — извлечение

network — сеть

to share — делить

humanities — гуманитарные науки

business transactions — коммерческие операции

to browse — рассматривать, разглядывать

browser — браузер (программа поиска информации)

provider — провайдер (компания, предоставляющая доступ к WWW через местные телефонные сети)

broadcast live — передавать в прямом эфире

site — страница, сайт

to link — соединять

hyperlink — гиперссылка

to compete — соревноваться

2. Read and translate the text:

INTRODUCTION TO THE WWW AND THE INTERNET

Millions of people around the world use the Internet to search for and retrieve information on all sorts of topics in a wide variety of areas including the arts, business, government, humanities, news, politics and recreation. People communicate through electronic mail (e-mail), discussion groups, chat channels and other means of informational exchange. They share information and make commercial and business transactions. All this activity is possible because tens of thousands of networks are connected to the Internet and exchange information in the same basic ways.

The World Wide Web (WWW) is a part of the Internet. However, it is not a collection of networks. Rather, it is information that is connected or linked together like a web. You access this information through one interface or tool called a Web browser. The number of resources and services that are part of the World Wide Web is growing extremely fast. In 1996, there were more than 20 million users of the WWW, and more than half the information that is transferred across the Internet is accessed through the WWW. By using a computer terminal (hardware) connected to a network, that is a part of the Internet, and by using a program (software) to browse or retrieve information that is a part of the World Wide Web, the people connected to the Internet and World Wide Web through the local providers have access to a variety of information. Each browser provides a graphical interface. You move from place to place, from site to site on the Web by using a mouse to click on a portion of text, icon or region of a map. These items are called hyperlinks or links. Each link you select represents a document, an image, a video clip or an audio file somewhere on the Internet. The user doesn't need to know where it is, the browser follows the link.

All sorts of things are available on the WWW. One can use Internet for recreational purposes. Many TV and radio stations broadcast live on the WWW. Essentially, if something can be put into digital format and stored in a computer, then it's available on the WWW. You can even visit museums, gardens, cities throughout the world, learn foreign languages and meet new friends. Moreover, of course, you can play computer games through WWW, competing with partners from other countries and continents.

Just a little bit of exploring the World Wide Web will show you what a lot of use and fun it is.

3. General understanding. Answer the questions to the text:

1) What is Internet used for?

2) Why so many activities such as e-mail and business transactions are possible through the Internet?

3) What is World Wide Web?

4) What is Web browser?

5) What does a user need to have an access to the WWW?

6) What are hyperlinks?

7) What resources are available on the WWW?

8) What are the basic recreational applications of WWW?

4. Which of the listed below statements are true/false. Specify your answer using the text.

1) There are still not so many users of the Internet.

2) There is information on all sorts of topics on the Internet, including education and weather forecasts.

3) People can communicate through e-mail and chat programs only.

4) Internet is tens of thousands of networks, which exchange the information in the same basic way.

5) You can access information available on the World Wide Web through the Web browser.

5. Define the following using the vocabulary:

1) Internet 2) World Wide Web

3) Web browser 4) Internet provider

5) Hyperlinks

6. Say in English:

1. Объем ресурсов и услуг, которые являются частью WWW, растет чрезвычайно быстро.

2. Каждая ссылка, выбранная вами, представляет документ, графическое изображение, видеоклип или аудиофайл где-то в Интернет.

3. Интернет может быть также использован для целей развлечения.

4. Вы получаете доступ к ресурсам Интернет через интерфейс или инструмент, который называется веб браузер.

5. Вся эта деятельность возможна благодаря десятку тысяч компьютерных сетей, подключенных к Интернет и обменивающихся информацией в одном режиме.

6. Пользователи общаются через электронную почту, дискуссионные группы, чэт-каналы (многоканальный разговор в реальном времени) и другие средства информационного обмена.

7. Match the following:

1) You access the information through one interface or tool called a....

2) People connected to the WWW through the local... have access to a variety of information.

3) The user doesn't need to know where the site is, the... follows the...

4) In 1996 there were more than 20 million users of the...

5) Each... provides a graphical interface.

6) Local... charge money for their services to access... resources.

Words to match with:

web browser, providers, link, WWW,

8. Read the text and ask questions to it:




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


Дата добавления: 2014-12-27; Просмотров: 847; Нарушение авторских прав?; Мы поможем в написании вашей работы!


Нам важно ваше мнение! Был ли полезен опубликованный материал? Да | Нет



studopedia.su - Студопедия (2013 - 2024) год. Все материалы представленные на сайте исключительно с целью ознакомления читателями и не преследуют коммерческих целей или нарушение авторских прав! Последнее добавление




Генерация страницы за: 0.32 сек.