| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1063 人关注过本帖
标题:英文原版的c语言教程。。。
只看楼主 加入收藏
angleo
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2005-11-19
收藏
 问题点数:0 回复次数:3 
英文原版的c语言教程。。。
c语言原版的教程,我给大家发点儿。。。是我自己一个一个字敲的,辛苦着呢。

1.1 Introduction to Programming

A computer is a machine. Like other machines, such as automobile or lawn mower, it must be turned on and the driven, or controlled, to do the task it was meant to do. In an automobile, for an example, the driver provides control by sitting inside of and directing the car. In a computer, the diver is a set of introductions called a program. More formally, a computer program is a sequence of instructions used to operate a computer to produce a specific result. Programming is the process of writing these introductions in a language that the computer can respond to and that other programmers can understand. The set of instructions that can be used to construct a program is called a programming language.

Essentially, all computer programs do the same thing. They direct a computer to accept data, to manipulate the data, and to produce reports. This means that all programming languages must provide similar capabilities for performing these operations. These capabilities are provided either as specific instruction types, or prepackaged groups of instructions that can be used to do specific tasks. In C, the prepackaged groups of instructions are called library functions. Table 1.1 lists the fundamental set of instructions and library functions provided by FORTRAN, BASIC, COBOL, Pascal, and C for performing input, processing, and output tasks.

If all programming languages provide essentially the same features, why are there so many? The answer is that there are vast differences in the types of input data, calculations needed, and output reports required by applications. For example, scientific and engineering applications require precise numerical outputs, accurate to many decimal places. In addition, these applications typically use many mathematical equations to produce their results. For example, calculating the bacteria concentration level in a polluted pond, as illustrated in Figure 1.2, requires evaluation of an exponential equation. For such applications, the FORTRAN programming language, with its algebra-like instructions, was developed. FORTRAN, an acronym for FORmulaTRANslation, was introduced in 1957 and specifically developed for translating formulas into a computer-readable form.

Business applications usually deal in whole numbers, representing inventory quantities, or dollar and cents data accurate to only two decimal places. These applications require similar mathematical calculations than are needed for scientific applications. The outputs required from business programs frequently consist of reports containing extensive columns of formatted dollar and cents numbers and totals. For these applications, the COBOL programming language, with its picture output formats, was introduced in the 1960s. COBOL is an acronym for Common Business Oriented Language.

Teaching introductory programming to students has its own set of requirements. Here, a straightforward, east-to-understand computer language was needed that does not require detailed knowledge of a specific application. Both the BASIC and PASIC languages were developed for this purpose. BASIC stands for Beginners ALL-purpose Symbolic Instruction Code and was developed in 1960s an Dartmouth College. Visual Basic, the updated object-based version of BASIC, is still ideal for creating small, easily developed, interactive programs.

Pascal was developed in the late 1970s to provide students with a firmer foundation in modular and structured programming than could be provided by BASIC. Modular programs consist of many small subprograms, each of which performs a clearly defined and specific task that can be tested and modified without disturbing other program sections. Pascal is not an acronym, like FORTRAN, COBOL, and BASIC, but is named after the seventeenth-century mathematician, Blaise Pascal. The Pascal language is so rigidly structured that there are on escape from the structured modules. This is unacceptable for real-world projects and was one reason Pascal did not gain wide acceptance in the scientific, engineering, and business fields. The design philosophy called structure programming that led to the development of Pascal is, however, relevant to C program. Using a structured programming approach results in readable, reliable, and maintainable programs. We will introduce the elements of this program design philosophy in the next section and continue expanding on it and using it throughout the text.

The C language was initially developed in the 1970s an AT&T Bell Laboratories. C evolved from a language called B, which was developed from the BCPL language. C has an extensive set of capabilities and is a true general-purpose programming language. It can be used for creating simple, interactive program; for producing sophisticated applications, such as designing operating systems; and for both business and scientific programming applications. C’s richness of library and instruction capabilities is clearly evident from Table 1.1. Besides provides many existing tools to build programs, C allows the programmer to easily create new tools. For this reason, C became know as the “professional programmer’s language”. The current standard for C is maintained by the American National Standard Institute (ANSI).

Algorithms

Before write a program, a programmer must clearly understand the desired result and how the proposed program will produce it. In this regard, it is useful to realize that a computer program describes a computational produce called an algorithm. An algorithm is a step-by-step sequence of instructions that describes how to perform a computation.

An algorithm answers the question, “What method will you use to solve this computational problem?” Only after we clearly understand the algorithm, and know the specific steps required to produce the desired result, can we write the program. Seen in this light, programming is the translation of the selected algorithm into a language that the computer can use.

To illustrate an algorithm, we will consider a simple requirement. Assume that a program must calculate the sum of all whole numbers from 1 to 100. Figure 1.4 illustrate three methods we could use to find the required sum. Each method constitutes an algorithm.

Clearly, most people do not bother listing the possible alternatives in a detailed step-by step manner, as shown in Figure 1.4, and then selecting one of the algorithms to solve the problem. But then, most people do not think algorithmically; they tend to think intuitively. For example, if you have to change a flat tire on your car, you would not think all the steps required-you would simply change the tires or call some one to do the job. This is an example of intuitive thinking.

Unfortunately, computers do not respond to intuitive commands. A general statement such as “add the numbers from 1 to 100” means nothing to a computer, because the computers can only respond to algorithmic commands written in an acceptable language such as C. To program a computer successfully, you must clearly understand the difference between algorithmic and intuitive commands. A computer is a “algorithm-responding” machine; it is not a “intuitive-responding” machine. You can not call a computer to change a tire or to add the numbers from 1 to 100. Instead, you must give the computer a detailed, step-by-step set of instructions that, collectively, forms an algorithm. For example, the set of instructions…………..forms a detailed method, or an algorithm, for determining the sum of the numbers from 1 through 100. Notice that this instructions are not a computer program. Unlike a program, which must be written in a language the computer can understand, an algorithm can be written or described in various ways. When English phrase are used to describe an algorithm, as in this example, the description is called pseudocode. When mathematical equations are used, the description is called a formula. When pictures that employ specifically defined shapes are used, the description is called a flowchart. A flowchart provides a pictorial representation of the algorithm using the symbols shown in Figure 1.5. Figure 1.6 illustrate the use of these symbols in depicting an algorithm for determining the average of the three numbers.

From algorithms to programs

Once selected, an algorithm must be converted into a form that can be used by a computer. Converting an algorithm into a computer program, using a language such as C, is called coding the algorithm. The remainder of this text is devoted mostly to showing you how to develop algorithms and expressing these algorithms in C.

Program Translation

Once a program is written in C, in cannot be executed without further translation on the computer. This is because the internal language of all computers consist of a series of 1s and 0s, called the computer’s machine language. To generate a machine-language program that can be executed by a computer requires that the C program, which is referred to as the source program, be translated into the computer’s machine language.

搜索更多相关主题的帖子: c语言 原版 教程 英文 automobile 
2005-12-08 00:08
angleo
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2005-11-19
收藏
得分:0 
连载的。。。慢慢会全发上来的

2005-12-08 00:10
angleo
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2005-11-19
收藏
得分:0 
大家帮忙顶啊

2005-12-08 20:36
yk87458410
Rank: 1
等 级:新手上路
帖 子:65
专家分:0
注 册:2005-9-26
收藏
得分:0 

你的这个东西是,你写的辛苦我看的也辛苦。还是中文好啊。


2005-12-08 21:42
快速回复:英文原版的c语言教程。。。
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.045153 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved