


全文预览已结束
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
毕业设计论文附件a编程语言编写计算机程序有两种常用方法:面向过程的程序设计和面向对象的程序设计。面向对象的程序设计是面向过程程序设计的一种扩展,在编写程序时采用的方法有一些不同,用面向对象的方法考虑问题,首先把程序元素看成是与现实世界中的具体对象相似的对象,然后对这些对象进行操作以得到期望的结果。编写面向对象的程序包括创建对象和创建使用这些对象的应用程序。机器语言能被计算机操作系统直接运行的计算机程序称为可执行程序。可执行程序是以机器码的形势表示的一系列非常简单的指令。这些指令对于不同计算机的cpu而言是特定的,它们与硬件有关。例如,英特尔“奔腾”处理器和power pc微处理器芯片各自有不同的机器语言,要求用不同的代码集来完成相同的任务。机器码指令是从存储单元取数据,或将两个存储单元的内容相加(通常在cpu的寄存器中进行)。机器码指令是二进制的比特序列(0和1)。由于这些数字令人难以理解,所以计算机指令通常不是用机器码来写的。汇编语言与机器语言指令相比,汇编语言使用的命令较容易为程序员理解。每条机器语言指令在汇编语言中有等价的命令。例如,在汇编语言中,语句“mov a,b”命令表示计算机把数据从一个单元复制到另一个单元,而及其代码中同样的指令是有一串16位的0和1组成的。一旦汇编语言程序编写完毕,它就由另一个称之为汇编起的程序转换成机器语言程序。相对于机器语言而言,汇编语言速度快,功能强。可它仍然难以利用,因为汇编语言指令是有一系列抽象代码组成的。另外,不同的cpu使用不同的机器语言,因此需要不同的汇编语言(程序)。有时为了执行特殊的硬件任务,或者为了加快高级语言程序的速度,汇编语言被插入到高级语言程序中。高级语言从机器语言进步到汇编语言,是语言达到了更先进的阶段。同样也正是这种进步导致了高级语言的发展。如果计算机能把简便的符号翻译成基本操作,为什么它就不能完成其他文字类型的编码功能呢?现在让我们来看看所期望的高级语言应有的特点,以及怎样将它们与机器码和汇编语言进行比较。高级程序语言是这样一种编程手段,它用规范化的术语来写出一步步的程序步骤,执行这些步骤时会用唯一确定的方式处理工作。高级语言经常针对某类特殊的处理问题而设计,例如,一些语言设计成适宜处理科学计算问题,另一些语言则更侧重于文件处理的应用。面向对象编程语言像c+这样的面向对象程序语言(oop)是以传统的高级语言为基础,但是它们能使程序员按照组合对象集方式而不是指令列表方式来进行思考。对象有许多性质,以圆为例,就有圆的半径以及把圆画到计算机屏幕上的命令。对象的类可以从其他对象类那里继承属性。例如,一个定义正方形的类能从定义长方形的类那里继承诸如直角这样的属性。程序类的这种关系简化了程序员的工作,从而导致更多既可靠又高效的程序产生。附件bprogramming languagethere are two popular approaches to writing computer programs: procedural programming(面向过程的程序设计) and object-oriented programming(面向对象的程序设计).machine languagecomputer programs that can be run by a computers operating system are called executables(可执行程序). an executable program is a sequence(序列) of(一系列的) extremely(非常地) simple instructions known as machine code. these instructions are specific to the individual computers cpu and associated(相关的) hardware; for example, intel pentium and power pc microprocessor chips each have different machine languages and require different sets of codes to perform the same task. machine code instructions are few in number(roughly概略的 20 to 200,depending on the computer and the cpu).typical(典型的) instructions are for copying data from a memory location or for adding the contents of two memory locations (usually registers in the cpu). machine code instructions are binary二进制_that is, sequences of bits (0s and 1s). because these numbers are not understood easily by humans, computer instructions usually are not written in machine code.assembly language汇编语言assembly language uses commands that are easier for programmers to understand than machine-language commands. each machine language instruction has an equivalent(等价的) command in assembly language. for example, in assembly language, the statement “mov a,b”instructs(命令) the computer to copy data from one location to another. the same instruction in machine code is a string of (一串)16 0s and 1s. once an assembly-language program is written, it is converted to a machine-language program by another program called an assembler(汇编器). assembly language is fast and powerful because of its correspondence with machine language. it is still difficult to use, however, because assembly-language instructions are a series of abstract(抽象的) codes. in addition, different cpus use different machine languages and therefore require different assembly languages. assembly language is sometimes inserted into a high-level program.high-level languagesthe improvement of machine language to assembly language set the stage for further advances. it was this improvement that led, in turn, to the development of high-level languages. if the computer could translate convenient symbols into basic operations, why couldnt it also perform other clerical coding functions?let us now look at the features we would expect to find in a high-level language and how they compare with machine code and assembly language.3 a high-level programming language is a means of data in a uniquely defined way. it may bear no relation to any given computer but does assume that a computer is going to be used. the high-level languagees are often oriented toward a particular class of processing problems. for example, a number of languages have been designed to process problems of a scientific_mathematic nature, and other languages have appered that emphasize file processing applications.object-oriented programming languagesobject-oriented programming(oop)languages like c+ are based on traditional high-level languages, but they enable a programmer to think in terms of collections of cooperating objects instead of lists of commands. objects, such as a circle, have properties such as the radius of the circle and the command that draws it on the computer screen.4 classes of objects can inherit features such as right angles from a class edfining rectangles. this set of programming classes simplifies the progammers task, resulting in more reliable and efficient programs.the long-term productivity of systems is enhanced by object-oriented program. because of the modular nature of the code, programs are more malleable. this is particularly beneficial for applications that will be used for many years, during which company needs may change and make software modifications necessary. software reliability can be improved by object-oriented programming. since the objec
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
评论
0/150
提交评论