文库 计算机英语课件,计算机专业英语学习情景2:计算机编程课件.ppt

《计算机专业英语学习情景2:计算机编程课件.ppt》由会员分享,提供在线免费全文阅读可下载,此文档格式为ppt,更多相关《计算机专业英语学习情景2:计算机编程课件.ppt》文档请在天天文库搜索。

1、计算机专业英语主讲教师:能力提高篇Multimedia3.Computer Programming2.Office Automation1.Network & E-commerce4.2能力提高篇Interview Skills7.Mobile Information Technology6.Global Software Outsourcing5.3Learning Scenarios 2 Computer ProgrammingWords & ExpressionsText A: Milestones of Programming LanguagesText B: Types in the C Programming LanguagePracticeReading MaterialWords & Expressions - 15Words & Expressions - 26Words。

2、 & Expressions - 37Words & Expressions - 48Text A: Milestones of Programming LanguagesPara 1. The first programming languages predate the modern computer. At first, the languages were codes. The Jacquard loom, invented in 1801, used holes in punched cards to represent sewing loom arm movements in order to generate decorative patterns automatically. During a nine-month period in 1842-1843, Ada Love。

3、lace translated the memoir of Italian mathematician Luigi Menabrea about Charles Babbage's newest proposed machine, the Analytical Engine.① With the article, she appended a set of notes which specified in complete detail a method for calculating Bernoulli numbers with the Engine, recognized by some historians as the world's first computer program. Herman Hollerith realized that he could encode inf。

4、ormation on punch cards when he observed that train conductors encode the appearance of the ticket holders on the train tickets using the position of punched holes on the tickets. Hollerith then encoded the 1890 census data on punch cards.9Para 2. The first computer codes were specialized for their applications. In the first decades of the 20th century, numerical calculations were based on decimal。

5、 numbers. Eventually it was realized that logic could be represented with numbers, not only with words. For example, Alonzo Church was able to express the lambda calculus in a formulaic way. The Turing machine was an abstraction of the operation of a tape-marking machine, for example, in use at the telephone companies. Turing machines set the basis for storage of programs as data in the von Neuman。

6、n architecture of computers by representing a machine through a finite number. However, unlike the lambda calculus, Turing's code does not serve well as a basis for higher-level languages—its principal use is in rigorous analyses of algorithmic complexity.Text A: Milestones of Programming Languages10Para 3. Like many "firsts" in history, the first modern programming language is hard to identify. F。

7、rom the start, the restrictions of the hardware defined the language. Punch cards allowed 80 columns, but some of the columns had to be used for a sorting number on each card. FORTRAN included some keywords which were the same as English words, such as "IF", "GOTO" (go to) and "CONTINUE". The use of a magnetic drum for memory meant that computer programs also had to be interleaved with the rotatio。

8、ns of the drum. Thus the programs were more hardware-dependent.Text A: Milestones of Programming Languages11Para 4. To some people, what was the first modern programming language depends on how 。省略部分。   { int max = 20; char * name = (char *)malloc(max); // allocate buffer if(NULL == name) quit(); 83printf("Please enter your first name:\n"); while(true) { // skip leading whitespace int c = getchar(。

9、); if(EOF == c) break; // end of file if(!isspace(c)) { ungetc(c, stdin); break; } } int i = 0; while(true) { int c = getchar(); if('\n' == c || EOF == c) { // at end; add terminating zero 84name[i] = 0; break; } name[i] = c; if(max-i == 1) { // buffer full max = max + max; name = (char *)realloc(name, max);     // get a new and larger buffer if(NULL == name) quit(); } ++ i; } printf("Hello %s\n",。

10、 name); free(name); // release memory return 0;     }85Compared to the previous versions, this seems rather complex. I feel a bit bad adding the code for skipping whitespace because I didn’t explicitly require that in the original problem statement. However, skipping initial whitespace is the norm and the other versions of the program skip whitespace. One could argue that this example isn’t all th。

11、at bad. Most experienced C and C++ programmers would – in a real program – probably (hopefully?) have written something equivalent in the first place. We might even argue that if you couldn’t write that program, you shouldn’t be a professional programmer. However, consider the added conceptual load on a novice. 86This variant uses nine different standard library functions, deals with character-lev。

12、el input in a rather detailed manner, uses pointers, and explicitly deals with free store. To use realloc() while staying portable, I had use malloc() (rather than new). This brings the issues of sizes and casts into the picture. It is not obvious what is the best way to handle the possibility of memory exhaustion in a small program like this. Here, I simply did something obvious to avoid the disc。

13、ussion going off on another tangent. Someone using the C-style approach would have to carefully consider which approach would form a good basis for further teaching and eventual use. To summarize, to solve the original simple problem, I had to introduce loops, tests, storage sizes, pointers, casts, and 87  explicit free-store management in addition to whatever a solution to the problem inherently 。

14、needs. This style is also full of opportunity for errors. Thanks to long experience, I didn’t make any of the obvious off-by-one or allocation errors. Having primarily worked with stream I/O for a while, I initially made the classical beginner’s error of reading into a char (rather that into an int and forgetting to check for EOF. In the absence of something like the C++ standard library, it is no wonder that many teachers stick EOF. with the "hoddy" solution and postpone these issues until later. 88Thank You !。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值