1 Introduction to Computers
and the Fortran Language
1
1.1 The Computer 2
1.2 Data Representation in a Computer 4
1.3 Computer Languages 12
1.4 The History of Fortran Language 12
1.5 The Evolution of Fortran 15
1.6 Summary 16
1.7 Exercises 19
2 Basic Elements of Fortran 21
2.1 The Fortran Character Set 21
2.2 The Structure of a Fortran Statement 22
2.3 The Structure of a Fortran Program 24
2.4 Constants and Variables 27
2.5 Assignment Statements and Arithmetic Calculations 36
2.6 Assignment Statements and Logical Calculations 45
2.7 Assignment Statements and Character Variables 48
2.8 Intrinsic Functions 51
2.9 List-Directed Input and Output Statements 54
2.10 Initialization of Variables 60
2.11 The IMPLICIT NONE Statement 61
2.12 Program Examples 63
2.13 Debugging Fortran Programs 70
2.14 Summary 72
2.15 Exercises 78
3 Control Structures and Program Design 83
3.1 Introduction to Top-Down Design Techniques 83
3.2 Use of Pseudocode and Flowcharts 88
3.3 Control Constructs: Branches 90
3.4 Control Constructs: Loops 108
3.5 More on Debugging Fortran Programs 139
3.6 Summary 141
3.7 Exercises 145
4 Basic I/O Concepts 153
4.1 Formats and Formatted WRITE Statements 153
4.2 Output Devices 154
4.3 Format Descriptors 157
4.4 Formatted READ Statements 175
4.5 An Introduction to Files and File Processing 182
4.6 Summary 200
4.7 Exercises 204
5 Arrays 211
5.1 Declaring Arrays 212
5.2 Using Array Elements in Fortran Statements 213
5.3 Using Whole Arrays and Array Subsets in Fortran Statements 225
5.4 Input and Output 229
5.5 Example Problems 235
5.6 Two-Dimensional or Rank-2 Arrays 249
5.7 Multidimensional or Rank-n Arrays 260
5.8 Using Fortran Intrinsic Functions with Arrays 263
5.9 Masked Array Assignment: The WHERE Construct 265
5.10 The FORALL Construct 269
5.11 Allocatable Arrays 272
5.12 When Should You Use an Array? 278
5.13 Summary 279
5.14 Exercises 284
6 Procedures and Structured Programming 302
6.1 Subroutines 304
6.2 The SAVE Attribute and Statement 332
6.3 Automatic Arrays 336
6.4 Sharing Data Using Modules 340
6.5 Module Procedures 347
6.6 Fortran Functions 355
6.7 Pure and Elemental Procedures 362
6.8 Passing Procedures as Arguments to Other Procedures 363
6.9 Summary 366
6.10 Exercises 373
7 More about Character Variables 383
7.1 Character Comparison Operations 384
7.2 Intrinsic Character Functions 388
7.3 Passing Character Variables to Subroutines and Functions 390
7.4 Variable-Length Character Functions 397
7.5 Internal Files 399
7.6 Example Problems 400
7.7 Summary 409
7.8 Exercises 412
8 Additional Data Types 418
8.1 Alternative Lengths of the REAL Data Type 418
8.2 Alternative Lengths of the INTEGER Data Type 440
8.3 Alternative Kinds of the CHARACTER Data Type 442
8.4 The COMPLEX Data Type 442
8.5 Derived Data Types 452
8.6 Summary 464
8.7 Exercises 468
9 Advanced Features of Procedures and Modules 474
9.1 Internal Procedures 474
9.2 Scope and Scoping Units 476
9.3 Recursive Procedures 481
9.4 Keyword Arguments and Optional Arguments 484
9.5 Procedure Interfaces and Interface Blocks 489
9.6 Generic Procedures 493
9.7 Extending Fortran with User-Defined Operators and Assignments 503
9.8 Restricting Access to the Contents of a Module 515
9.9 Advanced Options of the USE Statement 518
9.10 Summary 521
9.11 Exercises 527
10 Advanced I/O Concepts 534
10.1 Additional Format Descriptors 534
10.2 Defaulting Values in List-Directed Input 542
10.3 Detailed Description of Fortran I/O Statements 543
10.4 Namelist I/O 563
10.5 Unformatted Files 567
10.6 Direct Access Files 568
10.7 Summary 580
10.8 Exercises 583
11 Pointers and Dynamic Data Structures 588
11.1 Pointers and Targets 589
11.2 Using Pointers in Assignment Statements 595
11.3 Using Pointers with Arrays 597
11.4 Dynamic Memory Allocation with Pointers 598
11.5 Using Pointers as Components of Derived Data Types 602
11.6 Arrays of Pointers 613
11.7 Using Pointers in Procedures 616
11.8 Binary Tree Structures 621
11.9 Summary 639
11.10 Exercises 642
12 Introduction to Numerical Methods 646
12.1 The Types of Errors Found in Computer Calculations 647
12.2 Numerical Applications 671
12.3 Summary 688
12.4 Exercises 689
13 Fortran Libraries 701
13.1 Types of Fortran Libraries 704
13.2 Using Fortran Libraries 710
13.3 Examples 717
13.4 Summary 745
13.5 Exercises 746
14 Redundant, Obsolescent, and Deleted Fortran Features 751
14.1 Pre-Fortran 90 Character Restrictions 751
14.2 Obsolescent Source Form 752
14.3 Redundant Data Type 752
14.4 Older, Obsolescent and/or Undesirable Specification Statements 752
14.5 Sharing Memory Locations COMMON and EQUIVALENCE 756
14.6 Undesirable Subprogram Features 763
14.7 Miscellaneous Execution Control Features 770
14.8 Obsolete Branching and Looping Structures 773
14.9 Redundant Features of I/O Statements 777
14.10 Summary 778

A Quick Summary of Common Attributes Used in Type
Declaration Statements Appendixes

A ASCII and EBCDIC Coding Systems 787
B Fortran 90/95 Intrinsic Procedures 793
C Order of Statements in a Fortran 90/95 Program 831
D Glossary 833
E Answers to Quizzes 851
Index
Return to Fortran 90/95 Home | MHHE Home

feedback form | permissions | international | locate your campus rep | request a review copy

digital solutions | publish with us | customer service | mhhe home


Copyright ©2001 The McGraw-Hill Companies.
Any use is subject to the Terms of Use and Privacy Policy.
McGraw-Hill Higher Education is one of the many fine businesses of the The McGraw-Hill Companies.