没有合适的资源?快使用搜索试试~ 我知道了~
Ada 95 语言手册
需积分: 9 23 下载量 67 浏览量
2009-12-06
16:05:35
上传
评论
收藏 1.36MB PDF 举报
温馨提示
试读
446页
Ada95 手册 虽然Ada不是很流行,但是手册也不是很好找,当然你可以去官网上,但下载下来看更方便,呵呵~
资源推荐
资源详情
资源评论
M A Smith - May not be reproduced without permission
Reproduction prohibited without permission of the author
√ r
Note: This is an example of comments, the more experienced programmer would probably miss out many of
the above comments as the effect of the code is easily understandable.
Comments that do not add to a reader’s understanding of the program code should be avoided. In some
circumstances the choice of meaning full names for memory locations is all that is required. As
begin
Deposit( My_Account, 100.00 );
Other_Account := My_Account; --Copy and
M A Smith - May not be reproduced without permission
Object-oriented Software in Ada 95 Second Edition
Object-oriented Software in Ada 95 Second Edition
Michael A. Smith
School of Computing
University of Brighton
M A Smith - May not be reproduced without permission
Contents
CONTENTS ...............................................................................................................................................................IV
1.1 GLOSSARY OF TERMS USED ..........................................................................................................................XV
1 INTRODUCTION TO PROGRAMMING.................................................................................................1
1.1 COMPUTER PROGRAMMING..............................................................................................................................1
1.2 PROGRAMMING LANGUAGES............................................................................................................................1
1.3 RANGE OF PROGRAMMING LANGUAGES.......................................................................................................2
1.3.1 Computer programming languages............................................................................................................2
1.3.2 The role of a compiler...................................................................................................................................2
1.4 A SMALL PROBLEM ..............................................................................................................................................3
1.5 SOLVING THE PROBLEM USING A CALCULATOR........................................................................................3
1.5.1 Making the solution more general..............................................................................................................4
1.6 SOLVING THE PROBLEM USING THE ADA 95 LANGUAGE.........................................................................4
1.6.1 Running the program.....................................................................................................................................6
1.7 THE DECLARE BLOCK............................................................................................................................................6
1.8 THE ROLE OF COMMENTS ..................................................................................................................................7
1.9 SUMMARY...............................................................................................................................................................8
1.10 A MORE DESCRIPTIVE PROGRAM ....................................................................................................................8
1.10.1 Running the new program............................................................................................................................9
1.11 TYPES OF MEMORY LOCATION.........................................................................................................................9
1.11.1 Warning........................................................................................................................................................10
1.12 REPETITION ..........................................................................................................................................................10
1.13 INTRODUCTION TO THE WHILE STATEMENT ..............................................................................................11
1.13.1 Conditions....................................................................................................................................................12
1.13.2 A while statement in Ada 95..................................................................................................................12
1.13.3 Using the while statement......................................................................................................................13
1.14 SELECTION............................................................................................................................................................14
1.14.1 Using the if statement..............................................................................................................................15
1.15 SELF-ASSESSMENT .............................................................................................................................................16
1.16 PAPER EXERCISES...............................................................................................................................................17
2 SOFTWARE DESIGN...................................................................................................................................18
2.1 THE SOFTWARE CRISIS......................................................................................................................................18
2.2 A PROBLEM , THE MODEL AND THE SOLUTION..........................................................................................18
2.2.1 Responsibilities............................................................................................................................................19
2.3 OBJECTS.................................................................................................................................................................19
2.3.1 The car as an object....................................................................................................................................20
2.4 THE CLASS............................................................................................................................................................21
2.5 METHODS AND MESSAGES ..............................................................................................................................21
2.6 CLASS OBJECTS...................................................................................................................................................21
2.7 INHERITANCE.......................................................................................................................................................22
2.8 POLYMORPHISM ..................................................................................................................................................23
2.9 SELF-ASSESSMENT .............................................................................................................................................23
3 ADA INTRODUCTION: PART 1...............................................................................................................25
3.1 A FIRST ADA PROGRAM....................................................................................................................................25
3.2 THE CASE OF IDENTIFIERS IN A PROGRAM .................................................................................................26
3.3 FORMAT OF AN ADA PROGRAM .....................................................................................................................26
3.3.1 Variable names............................................................................................................................................26
3.3.2 Comments.....................................................................................................................................................27
3.4 A LARGER ADA PROGRAM ..............................................................................................................................27
3.5 REPETITION: WHILE.............................................................................................................................................28
3.6 SELECTION: IF.....................................................................................................................................................28
3.7 OTHER REPETITION CONSTRUCTS .................................................................................................................29
Contents v
3.7.1 for...................................................................................................................................................................29
3.7.2 loop................................................................................................................................................................30
3.8 OTHER SELECTION CONSTRUCTS ..................................................................................................................31
3.8.1 case................................................................................................................................................................31
3.9 INPUT AND OUTPUT ...........................................................................................................................................32
3.10 ACCESS TO COMMAND LINE ARGUMENTS..................................................................................................33
3.10.1 Putting it all together.................................................................................................................................34
3.11 A BETTER CAT PROGRAM .................................................................................................................................34
3.11.1 Putting it all together.................................................................................................................................35
3.12 CHARACTERS IN ADA ........................................................................................................................................35
3.13 SELF-ASSESSMENT .............................................................................................................................................36
3.14 EXERCISES.............................................................................................................................................................37
4 ADA INTRODUCTION: PART 2...............................................................................................................38
4.1 INTRODUCTION ...................................................................................................................................................38
4.2 THE TYPE FLOAT..................................................................................................................................................38
4.2.1 Other Integer and Float data types..........................................................................................................39
4.3 NEW DATA TYPES ...............................................................................................................................................39
4.3.1 Type conversions.........................................................................................................................................40
4.3.2 Universal integer........................................................................................................................................40
4.3.3 Constant declarations................................................................................................................................40
4.4 MODIFIED COUNTDOWN PROGRAM..............................................................................................................41
4.5 INPUT AND OUTPUT IN ADA ............................................................................................................................41
4.6 THE PACKAGE ADA.FLOAT_TEXT_IO...........................................................................................................41
4.6.1 Output of floating point numbers.............................................................................................................42
4.6.2 Input of floating point numbers................................................................................................................42
4.7 THE PACKAGE ADA.INTEGER_TEXT_IO......................................................................................................42
4.7.1 Output of integer numbers.........................................................................................................................42
4.7.2 Input of integer numbers............................................................................................................................43
4.8 CONVERSION BETWEEN FLOAT AND INTEGER TYPES..............................................................................43
4.9 TYPE SAFETY IN A PROGRAM .........................................................................................................................44
4.10 SUBTYPES..............................................................................................................................................................44
4.10.1 Types vs. subtypes.......................................................................................................................................45
4.11 MORE ON TYPES AND SUBTYPES ...................................................................................................................45
4.11.1 Root_Integer and Root_Real.....................................................................................................................46
4.11.2 Type declarations: root type of type........................................................................................................46
4.11.3 Arithmetic with types and subtypes..........................................................................................................47
4.11.4 Warning........................................................................................................................................................47
4.11.5 Constrained and unconstrained types.....................................................................................................48
4.11.6 Implementation optimizations...................................................................................................................48
4.12 COMPILE-TIME AND RUN-TIME CHECKS .....................................................................................................49
4.12.1 Subtypes Natural and Positive......................................................................................................50
4.13 ENUMERATIONS..................................................................................................................................................50
4.13.1 Enumeration values....................................................................................................................................51
4.13.2 The attributes 'Val and 'Pos................................................................................................................51
4.14 THE SCALAR TYPE HIERARCHY......................................................................................................................52
4.14.1 The inbuilt types..........................................................................................................................................53
4.15 ARITHMETIC OPERATORS ................................................................................................................................53
4.15.1 Exponentiation............................................................................................................................................54
4.15.2 Monadic arithmetic operators..................................................................................................................54
4.16 MEMBERSHIP OPERATORS ...............................................................................................................................54
4.17 USE OF TYPES AND SUBTYPES WITH MEMBERSHIP OPERATOR...........................................................55
4.18 RELATIONAL OPERATORS................................................................................................................................56
4.18.1 Boolean operators..............................................................................................................................56
4.18.2 Monadic Boolean operators..................................................................................................................57
4.19 BITWISE OPERATORS.........................................................................................................................................57
4.20 SELF-ASSESSMENT .............................................................................................................................................58
剩余445页未读,继续阅读
资源评论
凌云雁
- 粉丝: 7
- 资源: 13
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于SpringBoot Mybatis-Plus TypeScript的微服务多租户SaaS管理快速开发框架 .zip
- 论文复现:QA-GNN: Reasoning with Language Models and Knowledge
- ipp(intel-oneAPI)下载地址.txt
- 基于spring-boot dubbox搭建的java分布式系统的前端管理.zip
- VLC+Qt demoVLC+Qt demo
- 海彪&龙梅子 - 寂寞的人伤心的歌 (DJ版) [mqms2].ogg
- 530springboot + vue 旅游管理系统.zip(可运行源码+数据库文件+文档)
- 基于SpringBoot + Thymeleaf + Layui + Apache Shiro 的后台管理系统 .zip
- 表1:长江大学文理学院课外学分申请表.et
- base.apk
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功