网站大量收购独家精品文档,联系QQ:2885784924

001C++程序设计2.ppt

  1. 1、本文档共67页,可阅读全部内容。
  2. 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
001C程序设计2

* * 语句: if((C1 C2) || (C3 C4)) S1; else S2; 其中C1,C2,C3和C4是子句,S1和S2是语句。 子句覆盖要求测试数据能使四个从句C1,C2,C3和C 4都分别至少取一次true值和至少取一次false值。 子句覆盖 * * templateclass T int Max(T a[], int n) {// 寻找a [ 0 : n - 1 ]中的最大元素 int pos = 0; for (int i = 1; i n; i++) if (a[pos] a[i]) pos = i; return pos; } 数据集a[0:4]=[2,4,6,8,9]提供何种覆盖 ? 数据集a[0:4]=[4,2,6,8,9]提供何种覆盖 ? 程序1-31 寻找最大元素 * * Edsger Wybe Dijkstra(Algol60编译器设计者和实现者,THE操作系统的设计者,72年图灵奖): “编程的艺术是处理复杂性的技术”。 “测试只能证明错误的存在,不能证明错误不存在”。 关于测试 * * 测试能够发现程序中的错误。一旦测试过程中产生的结果与所期望的结果不同,就可以了解到程序中存在错误。 确定并纠正程序错误的过程被称为调试(debug)。 逻辑推理 程序跟踪 调试(debug) * * 参数传递 递归思想 测试调试 第一章总结 * The two most important concepts in object-oriented programming are the class and the object. In the broadest term, an object is a thing, both tangible and intangible, which we can imagine. A program written in object-oriented style will consist of interacting objects. For a program to maintain bank accounts for a bank, we may have many Account, Customer, Transaction, and ATM objects. An object is comprised of data and operations that manipulate these data. * * * This diagram shows three instances of the Employee class. Their names are Bill, Steve, and Andy. They are more commonly referred to as Employee objects. One key fact to remember: A class must be defined before you can create an instance (object) of the class. * Notice that the name of the message we send to an object or a class must be the same as the method’s name. Because they are the same, the message name is commonly omitted from the diagram as shown above. Because they are the same, the phrase “calling an object’s method” is synonymous to “sending a message to an object.” * The deposit method in the previous slide is an action-only method. It takes some action when called, but returns no answer back to the caller. The getMonthlyFee method above is a value-returning method. When called, it returns a value. A method can be both: executes an action and returns some value. * * 发送消息得到返回值 这个消息没有变量 Acco

文档评论(0)

shuwkb + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档