文档详情

第5章教参.doc

发布:2018-06-19约1.61万字共11页下载文档
文本预览下载声明
第五章 编程与设计 5.1.1 Warm-up: Look at the cartoons, try to appreciate them and exchange understanding with your partner. 图1: 喂,我想知道,你有没有能把沙子从硬盘清除掉的程序啊? 图2: 电脑修好了,但不要敲入任何带有“E”的东西。 图3: Beam me up, Scotty!属流行语言,源于科幻电视《星舰奇航记》(Star Trek)。在剧中的意思是“斯科特,把我送回飞船5.1.2 Translation of the text: 计算机编程0000代表0,0001代表1,0010代表2,0011代表3等等。最初,程序看上去就是一串如“1010100100101111010101010101”没完没了的数字。既然编程的目的是使生活更安逸,010101”好得多。 将汇编语言转换为计算机代码的程序被称为汇编程序。但这并非万事大吉。有人继续考虑:为什么不开发一种程序,将近似英文的单词转换成汇编语言,那么代码可用英语写。于是现代的第三代代码横空出世。现在程序员会编写诸如“x = 5 + 8”或是 “String stupid = You are not smart”(字符‘愚蠢=你不聪明)的代码。 第一条x等于5 + 8;第条“stupid”(愚蠢的编译器汇编语言,汇编语言,Java是使用第三代代码编写技术的比较新的语言之一。 简而言之,编写代码意味着要写一串串指令。每个指令相对简单。电脑速度之快,能在一秒钟内运行数百万条指令。运行类是Diablo这样复杂的3D游戏,每秒钟运行数百万条代码行,因而每条代码行的作用似乎微乎其微。 但事实并非如此。作为程序员,关注的不仅仅是终端产品,还有每条代码行的运行状况。你所写的每条代码必须有助于整个程序的运行。 程序员所遇到的专业术语可分为关键字、操作符、变量、预定义(Java语言中的)几大类。对编译器“if”(如果)会告诉编译器情况属实,“+”能用于将两数相加。 变量是你赋予你所创建的某个字的值。比如,在Java语言中,关键字“int”指数字。如果你编写出“int sum = 8 + 7” ;表明你指示编译器sum(总数),是8和7的数值之和。从编写后到你变动前,一旦你在程序里写下“sum”,编译器“15”。在Java语言中,你所设置的预定义会给你帮大忙。将其写入代码,会省去大量编程工作。 5.1.3 Key to Exercises : I. Tell whether the following statements are true (T) or false (F) according to the text. ( F ) 1. Instructions based on a sequence of ons and offs are more complicated than assembly language. ( T ) 2. Assembler is able to convert the assembly language into computer code. ( T ) 3. Though each code line seems to do very little in the execution of the whole program, it still is very important. ( F ) 4. Keywords, operations, variables and predefined classes are common words that a programmer meets in programming. ( T ) 5. If you write “int sum = 9+ 2”, “sum” in the program is read as “11” until a change is made. II. Match the words or expressions in the left column with those similar in meaning in the right column. 1. assembly language A. 最短路径 2. data structures B. 生成子集 3. compiler C. 变量 4. sorting D. 终端产品 5. generating subsets E. 编译器 6. variable F. 预定义 7. shortest path G. 网络流 8. predefined classe
显示全部
相似文档