SPECIFICATION 2 STATEMENTS
|
|
- Sabrina Beasley
- 5 years ago
- Views:
Transcription
1 SPEIFIATION 2 STATEMENTS hapter SYS-ED/ OMPUTER EDUATION TEHNIQUES, IN.
2 Objectives: You will learn: Type specification. Type declarations other than HARATER. Statements: HARATER, IMPLIIT, DIMENSION, PARAMETER, EXTERNAL, OMMON, EQUIVALENE. Internal storage structure for arrays. hanging a value. SYS-ED \OMPUTER EDUATION TEHNIQUES, IN. (FORTRAN PRG ) h 2: Page i
3 1 Type Specification The type specification statements are used to assign a type to specific name and provide the compiler with information on the structure required for these names. This is necessary because: OMPLEX and DOUBLE PREISION REALS are both floating point format and require two arithmetic storage units per data element. INTEGER, REAL, and LOGIAL require one arithmetic storage unit per data element. HARATER items require one or more character storage units per data element depending on their length. DOUBLE PREISION OMPLEX items are floating point and require four arithmetic storage units per data element. SYS-ED \OMPUTER EDUATION TEHNIQUES, IN. (FORTRAN PRG ) h 2: Page 1
4 Type declarations are not executable and must precede the first executable statement in the program or subprogram. When dimension information appears in a declaration statement, the associated name becomes the name of an array, and the product of the declared sizes determines the amount of storage to be reserved for that array. No DIMENSION statement is needed if a name is dimensioned in a type statement. However, a name may be associated with dimension information in a DIMENSION statement and also appear in type statement without dimension information. Example: DIMENSION NONE(12) REAL MOST, NONE SYS-ED \OMPUTER EDUATION TEHNIQUES, IN. (FORTRAN PRG ) h 2: Page 2
5 The general form of this type declaration statement is: typ type-list 1.1. Type Declarations Other than HARATER where: typ is INTEGER, REAL, DOUBLE PREISION, OMPLEX, or LOGIAL, A type-list is a string of names separated by commas, with or without dimensions, separated by commas. Names may represent variables, arrays, symbolic constants, functions, and dummy procedures. Examples: OMPLEX DATA, DRIVE, IMPORT REAL INTENT, MPH, ZERO INTEGER FAR(60), AGE, YEAR, DATE LOGIAL MODEL, METHOD DOUBLE PREISION UNSURE, ALPHA(20,20), PLATE OMPLEX*16 VALS(100) SYS-ED \OMPUTER EDUATION TEHNIQUES, IN. (FORTRAN PRG ) h 2: Page 3
6 The general form of this type of declaration statement is: HARATER*n type-list 2 HARATER Statement where: type-list is a list of names, with optional dimension information and optional length specifications "*n", separated by commas. n is the optional length specification (if n is omitted, so is *), and may be any of the following: an unsigned, non-zero, INTEGER constant. a positive valued integer constant expression enclosed in parentheses. an asterisk in parentheses. A length specification immediately following the word HARATER sets the default length for all items in the list. If no length specification is given, the default is length one. A length specification immediately following a list item applies only to that item and overrides the list default. SYS-ED \OMPUTER EDUATION TEHNIQUES, IN. (FORTRAN PRG ) h 2: Page 4
7 Example: HARATER*5 ALPHA(8), TEXT, WORD34*12, WORDY*(6+3) ALPHA is a HARATER array of eight elements, each of which has length five. TEXT is a HARATER variable of length five. WORD34 is a HARATER variable of length twelve. WORDY is a HARATER variable of length nine. The length (*) may only be used for list items which are symbolic constant names, dummy arguments, or names which appear in a FUNTION, SUBROUTINE, or ENTRY statement. SYS-ED \OMPUTER EDUATION TEHNIQUES, IN. (FORTRAN PRG ) h 2: Page 5
8 3 IMPLIIT Statement The IMPLIIT statement is used to change or confirm the default implicit type associated with the first letter of a name. For example, the statement IMPLIIT INTEGER (W) would make INTEGER the implicit default type for names beginning with W. The general form of the IMPLIIT statement is: IMPLIIT type(r1,r2,...),type(...),... where: type is INTEGER, REAL, DOUBLE PREISION, OMPLEX, LOGIAL, HARATER, or HARATER*n (where n is the length of HARATER variables). rx is a single letter or range of letters in alphabetical order. A range is written as, for example, E-H. SYS-ED \OMPUTER EDUATION TEHNIQUES, IN. (FORTRAN PRG ) h 2: Page 6
9 An explicit type declaration overrides the type given by the IMPLIIT statement. An implicit type derived from the first letter of the name is used if the first letter does not appear in an IMPLIIT statement. The IMPLIIT statement only affects names in the program unit which contains it. With one exception, IMPLIIT statements must precede all other declaration statements in a program unit. The single exception is that PARAMETER statements may precede IMPLIIT statements; in such cases, the IMPLIIT statements have no effect on the type of the names used in the PARAMETER statements. A common use of the IMPLIIT statement is to declare all names to be implicitly LOGIAL (by IMPLIIT LOGIAL (A-Z)), and then to type explicitly all names used. This effectively renders FORTRAN more 'strongly typed' and gives the compiler more chance to flag the use of mis-spelt variables. Examples: IMPLIIT INTEGER(I-N),REAL(-H),DOUBLE PREISION(O-W) IMPLIIT OMPLEX(X,Y,Z),LOGIAL(B),HARATER*5(A) SYS-ED \OMPUTER EDUATION TEHNIQUES, IN. (FORTRAN PRG ) h 2: Page 7
10 4 DIMENSION Statement The programmer determines the size and attributes (number of subscripts and their bounds) of an array by reserving storage for the array in a DIMENSION statement, OMMON statement, or a type declaration statement. The form of the DIMENSION statement is: DIMENSION vl(dl),v2(d2),... where: The variable names, vj, have dimensions dj with one to seven dimension declarations separated by commas, as in SPAE(5,6,20). The DIMENSION statement is not executable and it must precede the first executable statement of a program or subprogram. The dimension declaration of a name must also precede the first use of the name in a DATA statement. It is not permitted to dimension the same array name more than once in a program unit. SYS-ED \OMPUTER EDUATION TEHNIQUES, IN. (FORTRAN PRG ) h 2: Page 8
11 Array elements are stored by columns in ascending locations. In the array declared as A(3,3,3): 4.1. Internal Storage Structure for Arrays A111 A121 A131 A211 A221 A231 A311 A321 A331 A112 A122 A132 A212 A222 A232 A312 A322 A332 A113 A123 A133 A213 A223 A233 A313 A323 A333 SYS-ED \OMPUTER EDUATION TEHNIQUES, IN. (FORTRAN PRG ) h 2: Page 9
12 5 OMMON Statement The OMMON statement is used to reserve a block of storage which can be accessed by different program units. This allows the different program units to define and reference the same data in the same storage locations without including the data as arguments in subprogram references. The OMMON statement also provides the user with the capability of forcing specific data elements to be stored in adjoining memory locations. The storage area reserved by a OMMON statement is called a common block. ommon blocks may be unlabelled or labeled (given a name). Example: OMMON ROSE(20), TULIP, PANSY, DAF OMMON /ZOO/ WOMBAT(20,30), IBEX(2), LION, MOOSE DIMENSION PANSY(100), MOOSE(18) SYS-ED \OMPUTER EDUATION TEHNIQUES, IN. (FORTRAN PRG ) h 2: Page 10
13 A statement which reserves the unlabelled (or blank) common block has the form: OMMON nlist And a statement which reserves labeled common has the form: OMMON /cbname1/ nlist1 /cbname2/ nlist2... where: cbnamej are common block names. nlistj are lists of variable names and array names (with or without dimension information) separated by commas. When subject to the following restrictions, a common block name may be any FORTRAN name and may be used elsewhere in a program as another kind of name: A common block name may not be the name of any symbolic constant referenced in the same program unit. A common block name may not be the name of an EXTERNAL function or subroutine referenced from the program unit. SYS-ED \OMPUTER EDUATION TEHNIQUES, IN. (FORTRAN PRG ) h 2: Page 11
14 The OMMON statement is not executable and must appear before the first executable statement in a program or subprogram. The order of DIMENSION, OMMON, EQUIVALENE, or type declarations is immaterial. Any number of OMMON statements may appear in a program unit. If a HARATER variable or array is in a common block, all the data elements in that common block must be of type HARATER. The length of a common block is determined from the number and type of the list variables. SYS-ED \OMPUTER EDUATION TEHNIQUES, IN. (FORTRAN PRG ) h 2: Page 12
15 6 EQUIVALENE Statement The EQUIVALENE statement is used to designate names which will share storage. EQUIVALENE is most commonly used when two or more arrays can share the same storage or when individual elements of an array are given specific names. The general form of the EQUIVALENE statement is: EQUIVALENE (nlist1), (nlist2),... where: nlistj is a list of variable names, array names, array element names or character substring names: (name1, name2,...) and each equivalence list must contain at least two names. Neither dummy arguments nor variables representing function names defined with current subprograms are allowed. Only integer constant expressions may be used as subscripts or substring expressions. Example: DIMENSION A(20), B(10), (12) EQUIVALENE (A,B), (A(16),(2)) The above EQUIVALENE statement associates: A(1) to A(10) with B(10). A(16) to A(20) with (2) to (6). SYS-ED \OMPUTER EDUATION TEHNIQUES, IN. (FORTRAN PRG ) h 2: Page 13
16 EQUIVALENE is not executable and must appear before the first executable statement. EQUIVALENE does not cause type conversion if the equivalenced names have different data types; nor does it imply mathematical equivalence; nor does a variable equivalenced to an array have the properties of an array. HARATER variables may only be equivalenced with other HARATER variables, but the lengths need not be equal. If the lengths of associated HARATER variables are not the same, their association in an EQUIVALENE statement may cause other associations, as in the following statements: HARATER A*6, B*6, (2)*4 EQUIVALENE (A,(1)), (B,(2)) This causes A and (1) to begin at the same first character position and also causes B and (2) to begin at the same character position. Since the subscripted variables are stored contiguously, although A and B have not been explicitly associated, the last two characters of A and the first two characters of B will always be identical. SYS-ED \OMPUTER EDUATION TEHNIQUES, IN. (FORTRAN PRG ) h 2: Page 14
17 6.1. Rules for EQUIVALENE Any variable may be made equivalent to any other variable, provided: Rule 1 Rule 2 Rule 3 It causes no rearrangement of the order in any common block, No common block is extended backwards from the first name explicitly declared in that common block. The same storage location is not referenced more than once in an equivalence list. Examples: Example 1: OMMON A(5), B(3) DIMENSION D(4) EQUIVALENE (A(5), D(1)), (B(2), D(3)) is legal and causes the associations: A(1) A(2) A(3) A(4) A(5) D(1) B(1) D(2) B(2) D(3) B(3) D(4) SYS-ED \OMPUTER EDUATION TEHNIQUES, IN. (FORTRAN PRG ) h 2: Page 15
18 Example 2: OMMON A(5), B(3) DIMENSION D(4) EQUIVALENE (A(4), D(1)), (B(1), D(4)) is illegal by rule 1. Example 3: EQUIVALENE (F,D(1)),(F,D(3)) is illegal by rule 3. Example 4: DIMENSION FAT(6) OMMON /IFAT/ SKINNY EQUIVALENE (SKINNY,FAT(2)) is illegal by rule 2. However, EQUIVALENE (SKINNY, FAT(1)) is legal. SYS-ED \OMPUTER EDUATION TEHNIQUES, IN. (FORTRAN PRG ) h 2: Page 16
19 6.2. hanging a Value The use of the EQUIVALENE statement to cause sharing of storage locations requires a knowledge of which FORTRAN statements cause a new value to be stored in a location. There are nine categories of such statements: Assignment statements store a new value in the variable on the left side of the equal sign. ASSIGN i TO n statements store a new value in n. A DO statement or an implied-do in an input/output list stores a new indexing value. READ statements store new values in the variables mentioned in the input list. Execution of input/output statements containing status specifications defining that variable. Execution of an INQUIRE causes certain entities to be defined. Equivalenced locations become defined when those locations are defined. Subprograms may change the value of an argument or variable in common. DATA statements cause locations to become initially defined. SYS-ED \OMPUTER EDUATION TEHNIQUES, IN. (FORTRAN PRG ) h 2: Page 17
20 7 PARAMETER Statement The PARAMETER statement is used to give a symbolic name to a constant. This is useful when a symbolic name would be more meaningful than a numeric constant, also when the user wants to guarantee that a name will not have its value changed by legal methods. Use of the PARAMETER statement also has the advantage of easing the updating of the program; a simple edit of one line will change the value of a constant throughout the program unit. Example: INTEGER SIZE PARAMETER (PLANK = E-27, SIZE=200) where: The form of the PARAMETER statement is: PARAMETER (name1 = const1, name2 = const2,...) namej is a FORTRAN name. constj is a constant expression. Each namej is the name of a constant which is defined with the value of the corresponding constj. Each constj is a constant expression containing only constants or previously defined symbolic constants. The expression constj is evaluated during compilation and converted to the type of namej; however, LOGIAL and HARATER names must have corresponding typed expressions. SYS-ED \OMPUTER EDUATION TEHNIQUES, IN. (FORTRAN PRG ) h 2: Page 18
21 Only one definition of a name by a PARAMETER statement is permitted in a program unit. With the following restrictions, a symbolic constant can appear anywhere that a constant of the same type could appear: A symbolic constant cannot appear as part of a FORMAT statement or a FORMAT specification. A symbolic constant must not be used to form part of another constant. For example, it may not be the integer, fraction, or exponent part of a REAL constant. If the type of a symbolic name of a constant is not the default type implied by its first letter, its type must be specified by a type statement or IMPLIIT statement prior to its appearance in a PARAMETER statement. The symbolic name may not appear in any other declaration statement except as part of array dimension information. If the symbolic name is to be HARATER and its length is not the default length of one, the length must also be specified before the appearance of the name in a PARAMETER statement; its length must not be changed by subsequent statements. SYS-ED \OMPUTER EDUATION TEHNIQUES, IN. (FORTRAN PRG ) h 2: Page 19
22 Examples: Example 1: PARAMETER (N=100) REAL A(N,N),B(2*N+1,N-1) DO 10 I = 1,N A(I,I) = D(I) 10 ONTINUE Example 2: INTEGER VALID(5), BEGIN PARAMETER (BEGIN=3) PARAMETER (TWO = 2.0, LAST = 3*BEGIN + 4) DATA VALID /0, 4*BEGIN/ OMMON /SHARE/ A(LAST), D(8) SYS-ED \OMPUTER EDUATION TEHNIQUES, IN. (FORTRAN PRG ) h 2: Page 20
23 8 EXTERNAL Statement When the actual argument list of a subprogram reference contains a name which will itself be used as a subprogram name it must be declared in an EXTERNAL statement in the calling routine. Example: SUBROUTINE PRIMES EXTERNAL MODULO... PRINT *, MULTI(K, MODULO, L1, L2)... END FUNTION MULTI(K, F, M1, M2) MULTI = K * F(M1,M2) END SYS-ED \OMPUTER EDUATION TEHNIQUES, IN. (FORTRAN PRG ) h 2: Page 21
24 The compiler treats F as a function in the function MULTI because F was not dimensioned as an array in MULTI. However, it is necessary to declare MODULO as a function in subroutine PRIMES so that the compiler will not treat it as a variable in the reference to MULTI. The EXTERNAL statement declares MODULO to be an external procedure (that is a function or subroutine). MULTI could be referenced elsewhere with a function other than MODULO as its second argument; MULTI would then be computed using that function instead of MODULO. The form of the EXTERNAL statement is: EXTERNAL name1, name2,... where: namej is a function, subroutine, or dummy argument name. EXTERNAL is non-executable and must appear before the first executable statement in a program unit. A function name used as an actual argument requires an EXTERNAL statement. However, a function reference used as an actual argument does not need to be in an EXTERNAL statement since it represents a value rather than the name of a function. SYS-ED \OMPUTER EDUATION TEHNIQUES, IN. (FORTRAN PRG ) h 2: Page 22
INTRODUCTION 1 AND REVIEW
INTRODUTION 1 AND REVIEW hapter SYS-ED/ OMPUTER EDUATION TEHNIQUES, IN. Programming: Advanced Objectives You will learn: Program structure. Program statements. Datatypes. Pointers. Arrays. Structures.
More informationChapter 3. Fortran Statements
Chapter 3 Fortran Statements This chapter describes each of the Fortran statements supported by the PGI Fortran compilers Each description includes a brief summary of the statement, a syntax description,
More informationPROGRAMMING 2 BASICS. Chapter SYS-ED/ COMPUTER EDUCATION TECHNIQUES, INC.
PROGRAMMING 2 BASIS hapter SYS-ED/ OMPUTER EDUATION TEHNIQUES, IN. Objectives You will learn: Programs and units. Features of the Object Pascal language. How to add comments. Parts of programs and units.
More informationVisual C# Instructor s Manual Table of Contents
Visual C# 2005 2-1 Chapter 2 Using Data At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class Discussion Topics Additional Projects Additional Resources Key Terms
More informationSubroutines and Functions
Subroutines and Functions Procedures: Subroutines and Functions There are two types of procedures: SUBROUTINE: a parameterized named sequence of code which performs a specific task and can be invoked from
More informationChapter 1 INTRODUCTION SYS-ED/ COMPUTER EDUCATION TECHNIQUES, INC.
hapter 1 INTRODUTION SYS-ED/ OMPUTER EDUATION TEHNIQUES, IN. ++ Programming: Advanced Objectives You will learn: Anonymous class types. Nested class declarations. Incomplete declarations. Pointers to class
More informationC++ Programming: From Problem Analysis to Program Design, Third Edition
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 2: Basic Elements of C++ Objectives (continued) Become familiar with the use of increment and decrement operators Examine
More informationFORTRAN 90: Functions, Modules, and Subroutines. Meteorology 227 Fall 2017
FORTRAN 90: Functions, Modules, and Subroutines Meteorology 227 Fall 2017 Purpose First step in modular program design Cannot always anticipate all of the steps that will be needed to solve a problem Easier
More informationIntroduction to Fortran Programming. -Internal subprograms (1)-
Introduction to Fortran Programming -Internal subprograms (1)- Subprograms Subprograms are used to split the program into separate smaller units. Internal subprogram is not an independent part of a program.
More informationISO/IEC : TECHNICAL CORRIGENDUM 2
ISO/IEC 1539-1:2010 - TECHNICAL CORRIGENDUM 2 ISO/IEC/JTC1/SC22/WG5-N1957 Notes for WG5: Edits included in this document from the interpretations in N1932 as amended by 12-193 and 12-194 and in N1949 as
More informationWatcom FORTRAN 77. Language Reference. Edition 11.0c
Watcom FORTRAN 77 Language Reference Edition 110c Notice of Copyright Copyright 2000 Sybase, Inc and its subsidiaries All rights reserved No part of this publication may be reproduced, transmitted, or
More informationChapter 1 INTRODUCTION. SYS-ED/ Computer Education Techniques, Inc.
Chapter 1 INTRODUCTION SYS-ED/ Computer Education Techniques, Inc. Objectives You will learn: Facilities and features of PL/1. Structure of programs written in PL/1. Data types. Storage classes, control,
More informationFORTRAN WATFIV. Mohammed Aslam CIS 24 Prof. Kopec Report 01 Date: 03/03/03
FORTRAN WATFIV Mohammed Aslam CIS 24 Prof. Kopec Report 01 Date: 03/03/03 WATFIV is an improvement over WATFOR. The University of Waterloo, Ontario, Canada, also developed it. Its name comes from the fact
More information3.Constructors and Destructors. Develop cpp program to implement constructor and destructor.
3.Constructors and Destructors Develop cpp program to implement constructor and destructor. Constructors A constructor is a special member function whose task is to initialize the objects of its class.
More informationThis manual is intended for Fortran 77 programmers who want to use Fortran 77 under GCOS7.
July 1991 1 Preface OBJECTIVES This manual has been prepared for users of the BULL DPS7, operating under release GCOS7. It contains information about Fortran 77 and the full specification of the language
More informationFRAC: Language Reference Manual
FRAC: Language Reference Manual Justin Chiang jc4127 Kunal Kamath kak2211 Calvin Li ctl2124 Anne Zhang az2350 1. Introduction FRAC is a domain-specific programming language that enables the programmer
More informationDECLARING 2 DATA ITEMS AND REPRESENTATION
DELARING 2 DATA ITEMS AND REPRESENTATION hapter SYS-ED/ OMPUTER EDUATION TEHNIQUES, IN. Objectives You will learn: How to declare PL/I variables with scale, base and mode. Internal representation of numeric,
More informationFortran 77 Language Reference Manual
Fortran 77 Language Reference Manual Document Number 007-0710-060 CONTRIBUTORS Written by David Graves and Chris Hogue Production by Julia Lin Cover design and illustration by Rob Aguilar, Rikk Carey,
More informationLanguage Fundamentals
Language Fundamentals VBA Concepts Sept. 2013 CEE 3804 Faculty Language Fundamentals 1. Statements 2. Data Types 3. Variables and Constants 4. Functions 5. Subroutines Data Types 1. Numeric Integer Long
More informationFortran Coding Standards and Style
Fortran Coding Standards and Style The Fortran Company Version 20160112 Copyright 2015-2016, The Fortran Company All rights reserved. Redistribution, with or without modification, is permitted provided
More informationUTILITY FUNCTION 1 PROGRAMS: GETTING STARTED
UTILITY FUNTION 1 PROGRAMS: GETTING STARTED hapter SYS-ED/ OMPUTER EDUATION TEHNIQUES, IN. Objectives You will learn: To identify the tasks which can be performed by the utility functions. Utility control
More informationIPCoreL. Phillip Duane Douglas, Jr. 11/3/2010
IPCoreL Programming Language Reference Manual Phillip Duane Douglas, Jr. 11/3/2010 The IPCoreL Programming Language Reference Manual provides concise information about the grammar, syntax, semantics, and
More informationDECLARATIONS. Character Set, Keywords, Identifiers, Constants, Variables. Designed by Parul Khurana, LIECA.
DECLARATIONS Character Set, Keywords, Identifiers, Constants, Variables Character Set C uses the uppercase letters A to Z. C uses the lowercase letters a to z. C uses digits 0 to 9. C uses certain Special
More informationUNIT - I. Introduction to C Programming. BY A. Vijay Bharath
UNIT - I Introduction to C Programming Introduction to C C was originally developed in the year 1970s by Dennis Ritchie at Bell Laboratories, Inc. C is a general-purpose programming language. It has been
More informationChapter 2: Using Data
Chapter 2: Using Data Declaring Variables Constant Cannot be changed after a program is compiled Variable A named location in computer memory that can hold different values at different points in time
More informationVariable and Data Type I
The Islamic University of Gaza Faculty of Engineering Dept. of Computer Engineering Intro. To Computers (LNGG 1003) Lab 2 Variable and Data Type I Eng. Ibraheem Lubbad February 18, 2017 Variable is reserved
More informationInformation technology Programming languages Fortran Part 1: Base language
INTERNATIONAL STANDARD ISO/IEC 1539-1:2010 TECHNICAL CORRIGENDUM 2 Published 2013-06-01 INTERNATIONAL ORGANIZATION FOR STANDARDIZATION МЕЖДУНАРОДНАЯ ОРГАНИЗАЦИЯ ПО СТАНДАРТИЗАЦИИ ORGANISATION INTERNATIONALE
More informationLEXICAL 2 CONVENTIONS
LEXIAL 2 ONVENTIONS hapter SYS-ED/ OMPUTER EDUATION TEHNIQUES, IN. ++ Programming Lexical onventions Objectives You will learn: Operators. Punctuators. omments. Identifiers. Literals. SYS-ED \OMPUTER EDUATION
More informationChapter 1 INTRODUCTION SYS-ED/ COMPUTER EDUCATION TECHNIQUES, INC.
hapter 1 INTRODUTION SYS-ED/ OMPUTER EDUATION TEHNIQUES, IN. Objectives You will learn: Java features. Java and its associated components. Features of a Java application and applet. Java data types. Java
More informationReserved Words and Identifiers
1 Programming in C Reserved Words and Identifiers Reserved word Word that has a specific meaning in C Ex: int, return Identifier Word used to name and refer to a data element or object manipulated by the
More information1 Lexical Considerations
Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Spring 2013 Handout Decaf Language Thursday, Feb 7 The project for the course is to write a compiler
More informationCS5000: Foundations of Programming. Mingon Kang, PhD Computer Science, Kennesaw State University
CS5000: Foundations of Programming Mingon Kang, PhD Computer Science, Kennesaw State University Overview of Source Code Components Comments Library declaration Classes Functions Variables Comments Can
More informationLecture 2 FORTRAN Basics. Lubna Ahmed
Lecture 2 FORTRAN Basics Lubna Ahmed 1 Fortran basics Data types Constants Variables Identifiers Arithmetic expression Intrinsic functions Input-output 2 Program layout PROGRAM program name IMPLICIT NONE
More informationChapter 4. Fortran Arrays
Chapter 4. Fortran Arrays Fortran arrays are any object with the dimension attribute. In Fortran 90/95, and in HPF, arrays may be very different from arrays in older versions of Fortran. Arrays can have
More informationProgramming in C++ 6. Floating point data types
Programming in C++ 6. Floating point data types! Introduction! Type double! Type float! Changing types! Type promotion & conversion! Casts! Initialization! Assignment operators! Summary 1 Introduction
More informationC How to Program, 6/e by Pearson Education, Inc. All Rights Reserved.
C How to Program, 6/e 1992-2010 by Pearson Education, Inc. An important part of the solution to any problem is the presentation of the results. In this chapter, we discuss in depth the formatting features
More informationCHAPTER 4 FUNCTIONS. 4.1 Introduction
CHAPTER 4 FUNCTIONS 4.1 Introduction Functions are the building blocks of C++ programs. Functions are also the executable segments in a program. The starting point for the execution of a program is main
More informationUNIT- 3 Introduction to C++
UNIT- 3 Introduction to C++ C++ Character Sets: Letters A-Z, a-z Digits 0-9 Special Symbols Space + - * / ^ \ ( ) [ ] =!= . $, ; : %! &? _ # = @ White Spaces Blank spaces, horizontal tab, carriage
More informationFortran. (FORmula TRANslator) History
Fortran (FORmula TRANslator) History FORTRAN vs. Fortran 1954 FORTRAN first successful high level language John Backus (IBM) 1958 FORTRAN II (Logical IF, subroutines, functions) 1961 FORTRAN IV 1966 FORTRAN
More informationBASIC ELEMENTS OF A COMPUTER PROGRAM
BASIC ELEMENTS OF A COMPUTER PROGRAM CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING LOGO Contents 1 Identifier 2 3 Rules for naming and declaring data variables Basic data types 4 Arithmetic operators
More informationData Types and Variables in C language
Data Types and Variables in C language Basic structure of C programming To write a C program, we first create functions and then put them together. A C program may contain one or more sections. They are
More informationInternational Standards Organisation. Parameterized Derived Types. Fortran
International Standards Organisation Parameterized Derived Types in Fortran Technical Report defining extension to ISO/IEC 1539-1 : 1996 {Produced 4-Jul-96} THIS PAGE TO BE REPLACED BY ISO CS ISO/IEC 1
More informationChapter 2 Basic Elements of C++
C++ Programming: From Problem Analysis to Program Design, Fifth Edition 2-1 Chapter 2 Basic Elements of C++ At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class Discussion
More informationThe New C Standard (Excerpted material)
The New C Standard (Excerpted material) An Economic and Cultural Derek M. Jones derek@knosof.co.uk Copyright 2002-2008 Derek M. Jones. All rights reserved. 1378 type specifier type-specifier: void char
More informationLexical Considerations
Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Spring 2010 Handout Decaf Language Tuesday, Feb 2 The project for the course is to write a compiler
More informationFeatures of C. Portable Procedural / Modular Structured Language Statically typed Middle level language
1 History C is a general-purpose, high-level language that was originally developed by Dennis M. Ritchie to develop the UNIX operating system at Bell Labs. C was originally first implemented on the DEC
More informationCOS 140: Foundations of Computer Science
COS 140: Foundations of Computer Science Variables and Primitive Data Types Fall 2017 Introduction 3 What is a variable?......................................................... 3 Variable attributes..........................................................
More informationPage 1 of 7. Date: 1998/05/31 To: WG5 From: J3/interop Subject: Interoperability syntax (Part 1) References: J3/98-132r1, J3/98-139
(J3/98-165r1) Date: 1998/05/31 To: WG5 From: J3/interop Subject: Interoperability syntax (Part 1) References: J3/98-132r1, J3/98-139 ISO/IEC JTC1/SC22/WG5 N1321 Page 1 of 7 Describing pre-defined C data
More informationStandard 11. Lesson 9. Introduction to C++( Up to Operators) 2. List any two benefits of learning C++?(Any two points)
Standard 11 Lesson 9 Introduction to C++( Up to Operators) 2MARKS 1. Why C++ is called hybrid language? C++ supports both procedural and Object Oriented Programming paradigms. Thus, C++ is called as a
More informationProgramming Language 2 (PL2)
Programming Language 2 (PL2) 337.1.1 - Explain rules for constructing various variable types of language 337.1.2 Identify the use of arithmetical and logical operators 337.1.3 Explain the rules of language
More informationby Pearson Education, Inc. All Rights Reserved.
Let s improve the bubble sort program of Fig. 6.15 to use two functions bubblesort and swap. Function bubblesort sorts the array. It calls function swap (line 51) to exchange the array elements array[j]
More informationLecture 2 Tao Wang 1
Lecture 2 Tao Wang 1 Objectives In this chapter, you will learn about: Modular programs Programming style Data types Arithmetic operations Variables and declaration statements Common programming errors
More informationStorage and Sequence Association
2 Section Storage and Sequence Association 1 1 HPF allows the mapping of variables across multiple processors in order to improve parallel 1 performance. FORTRAN and Fortran 0 both specify relationships
More information+2 Volume II OBJECT TECHNOLOGY OBJECTIVE QUESTIONS R.Sreenivasan SanThome HSS, Chennai-4. Chapter -1
Chapter -1 1. Object Oriented programming is a way of problem solving by combining data and operation 2.The group of data and operation are termed as object. 3.An object is a group of related function
More informationHEP PARALLEL FORTRAN USER'S MANUAL
HEP PARALLEL FORTRAN USER'S MANUAL DENELCOR PUBLICATION 10002-00 DENELCOR" INC. 3115 EAST 40th AVENUE DENVER, COLORADO 80205 NOT ICE This manual describes the facilities provided by the Heterogeneous Element
More informationThe PCAT Programming Language Reference Manual
The PCAT Programming Language Reference Manual Andrew Tolmach and Jingke Li Dept. of Computer Science Portland State University September 27, 1995 (revised October 15, 2002) 1 Introduction The PCAT language
More informationVB FUNCTIONS AND OPERATORS
VB FUNCTIONS AND OPERATORS In der to compute inputs from users and generate results, we need to use various mathematical operats. In Visual Basic, other than the addition (+) and subtraction (-), the symbols
More informationIntroduction to FORTRAN. Functions and Subroutines
Introduction to by Dr. Ibrahim A. Assakkaf Spring 2000 Department of ivil and Environmental Engineering University of Maryland Slide No. 1 Functions and Subroutines The objective herein is to use a topdown
More informationChapter 3. Numeric Types, Expressions, and Output
Chapter 3 Numeric Types, Expressions, and Output 1 Chapter 3 Topics Constants of Type int and float Evaluating Arithmetic Expressions Implicit Type Coercion and Explicit Type Conversion Calling a Value-Returning
More informationChapter 12 Variables and Operators
Chapter 12 Variables and Operators Basic C Elements Variables Named, typed data items Operators Predefined actions performed on data items Combined with variables to form expressions, statements Statements
More informationComputers Programming Course 5. Iulian Năstac
Computers Programming Course 5 Iulian Năstac Recap from previous course Classification of the programming languages High level (Ada, Pascal, Fortran, etc.) programming languages with strong abstraction
More informationIntroduction to Data Entry and Data Types
212 Chapter 4 Variables and Arithmetic Operations STEP 1 With the Toolbox visible (see Figure 4-21), click the Toolbox Close button. The Toolbox closes and the work area expands in size.to reshow the Toolbox
More informationunisys Enterprise Database Server for ClearPath MCP Transaction Processing System (TPS) Programming Guide imagine it. done. ClearPath MCP 13.
unisys imagine it. done. Enterprise Database Server for ClearPath MCP Transaction Processing System (TPS) Programming Guide ClearPath MCP 13.1 April 2011 8807 6138 004 NO WARRANTIES OF ANY NATURE ARE EXTENDED
More information9/7/17. Outline. Name, Scope and Binding. Names. Introduction. Names (continued) Names (continued) In Text: Chapter 5
Outline Name, Scope and Binding In Text: Chapter 5 Names Variable Binding Type bindings, type conversion Storage bindings and lifetime Scope Lifetime vs. Scope Referencing Environments N. Meng, S. Arthur
More informationLexical Considerations
Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Fall 2005 Handout 6 Decaf Language Wednesday, September 7 The project for the course is to write a
More informationMFS CONCEPTS 1 & COMPONENTS SYS-ED/ COMPUTER EDUCATION TECHNIQUES, INC.
hapter MFS ONEPTS 1 & OMPONENTS SYS-ED/ OMPUTER EDUATION TEHNIQUES, IN. IMS D and Message Format Services MFS oncepts & omponents Objectives You will learn: MFS - Message Format Services and the IMS system.
More informationGoals for This Lecture:
Goals for This Lecture: Understand what function subprograms are Understand how to use function subprograms Understand the various kinds of REAL types Understand how to select precision in a processor
More informationLESSON 1. A C program is constructed as a sequence of characters. Among the characters that can be used in a program are:
LESSON 1 FUNDAMENTALS OF C The purpose of this lesson is to explain the fundamental elements of the C programming language. C like other languages has all alphabet and rules for putting together words
More informationBinding and Variables
Binding and Variables 1. DEFINITIONS... 2 2. VARIABLES... 3 3. TYPE... 4 4. SCOPE... 4 5. REFERENCES... 7 6. ROUTINES... 9 7. ALIASING AND OVERLOADING... 10 8. GENERICS AND TEMPLATES... 12 A. Bellaachia
More information1 class Lecture2 { 2 3 "Elementray Programming" / References 8 [1] Ch. 2 in YDL 9 [2] Ch. 2 and 3 in Sharan 10 [3] Ch.
1 class Lecture2 { 2 3 "Elementray Programming" 4 5 } 6 7 / References 8 [1] Ch. 2 in YDL 9 [2] Ch. 2 and 3 in Sharan 10 [3] Ch. 2 in HS 11 / Zheng-Liang Lu Java Programming 41 / 68 Example Given the radius
More informationFull file at
Java Programming: From Problem Analysis to Program Design, 3 rd Edition 2-1 Chapter 2 Basic Elements of Java At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class
More informationCALL MC36A(NMAX,NZMAX,TITLE,ELT,NROW,NCOL,NNZERO, * COLPTR,ROWIND,VALUES,MAXRHS,NRHS,NZRHS,RHSPTR, * RHSIND,RHSVAL,GUESS,SOLN,IW,ICNTL,INFO)
PAKAGE SPEIFIATION 1 SUMMARY To read a sparse matrix, coded in a Harwell-Boeing format with possible right-hand sides. The subroutine reads assembled as well as unassembled matrices, and returns them in
More informationMATLIP: MATLAB-Like Language for Image Processing
COMS W4115: Programming Languages and Translators MATLIP: MATLAB-Like Language for Image Processing Language Reference Manual Pin-Chin Huang (ph2249@columbia.edu) Shariar Zaber Kazi (szk2103@columbia.edu)
More informationCSc 10200! Introduction to Computing. Lecture 2-3 Edgardo Molina Fall 2013 City College of New York
CSc 10200! Introduction to Computing Lecture 2-3 Edgardo Molina Fall 2013 City College of New York 1 C++ for Engineers and Scientists Third Edition Chapter 2 Problem Solving Using C++ 2 Objectives In this
More informationOverview (4) CPE 101 mod/reusing slides from a UW course. Assignment Statement: Review. Why Study Expressions? D-1
CPE 101 mod/reusing slides from a UW course Overview (4) Lecture 4: Arithmetic Expressions Arithmetic expressions Integer and floating-point (double) types Unary and binary operators Precedence Associativity
More informationC/C++ Programming for Engineers: Working with Integer Variables
C/C++ Programming for Engineers: Working with Integer Variables John T. Bell Department of Computer Science University of Illinois, Chicago Preview Every good program should begin with a large comment
More informationLESSON 5 FUNDAMENTAL DATA TYPES. char short int long unsigned char unsigned short unsigned unsigned long
LESSON 5 ARITHMETIC DATA PROCESSING The arithmetic data types are the fundamental data types of the C language. They are called "arithmetic" because operations such as addition and multiplication can be
More informationTokens, Expressions and Control Structures
3 Tokens, Expressions and Control Structures Tokens Keywords Identifiers Data types User-defined types Derived types Symbolic constants Declaration of variables Initialization Reference variables Type
More informationWalt Brainerd s Fortran 90 programming tips
Walt Brainerd s Fortran 90 programming tips I WORKETA - March, 2004 Summary by Margarete Domingues (www.cleanscape.net/products/fortranlint/fortran-programming tips.html) Fortran tips WORKETA - 2004 p.1/??
More informationChapter 7 Expressions and Assignment statements
Chapter 7 Expressions and Assignment statements 1 7.1 Introduction Expressions are the fundamental means of specifying computations in a programming language Semantics of expressions are discussed in this
More informationCSE101-lec#12. Designing Structured Programs Introduction to Functions. Created By: Amanpreet Kaur & Sanjeev Kumar SME (CSE) LPU
CSE101-lec#12 Designing Structured Programs Introduction to Functions Created By: Amanpreet Kaur & Sanjeev Kumar SME (CSE) LPU Outline Designing structured programs in C: Counter-controlled repetition
More informationMicrosoft Visual Basic 2005: Reloaded
Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 3 Variables, Constants, Methods, and Calculations Objectives After studying this chapter, you should be able to: Declare variables and named
More information2 nd Week Lecture Notes
2 nd Week Lecture Notes Scope of variables All the variables that we intend to use in a program must have been declared with its type specifier in an earlier point in the code, like we did in the previous
More informationReview More Arrays Modules Final Review
OUTLINE 1 REVIEW 2 MORE ARRAYS Using Arrays Why do we need dynamic arrays? Using Dynamic Arrays 3 MODULES Global Variables Interface Blocks Modular Programming 4 FINAL REVIEW THE STORY SO FAR... Create
More informationThe SPL Programming Language Reference Manual
The SPL Programming Language Reference Manual Leonidas Fegaras University of Texas at Arlington Arlington, TX 76019 fegaras@cse.uta.edu February 27, 2018 1 Introduction The SPL language is a Small Programming
More informationCOS 140: Foundations of Computer Science
COS 140: Foundations of Variables and Primitive Data Types Fall 2017 Copyright c 2002 2017 UMaine School of Computing and Information S 1 / 29 Homework Reading: Chapter 16 Homework: Exercises at end of
More informationSKILL AREA 306: DEVELOP AND IMPLEMENT COMPUTER PROGRAMS
Add your company slogan SKILL AREA 306: DEVELOP AND IMPLEMENT COMPUTER PROGRAMS Computer Programming (YPG) LOGO 306.1 Review Selected Programming Environment 306.1.1 Explain the concept of reserve words,
More informationChapter 8 :: Composite Types
Chapter 8 :: Composite Types Programming Language Pragmatics, Fourth Edition Michael L. Scott Copyright 2016 Elsevier 1 Chapter08_Composite_Types_4e - Tue November 21, 2017 Records (Structures) and Variants
More informationOur Strategy for Learning Fortran 90
Our Strategy for Learning Fortran 90 We want to consider some computational problems which build in complexity. evaluating an integral solving nonlinear equations vector/matrix operations fitting data
More informationChapter-8 DATA TYPES. Introduction. Variable:
Chapter-8 DATA TYPES Introduction To understand any programming languages we need to first understand the elementary concepts which form the building block of that program. The basic building blocks include
More informationPRELIMINARY APPLE BASIC USERS MANUAL OCTOBER Apple Computer Company. 770 Welch Rd., Palo Alto, CA (415)
PRELIMINARY APPLE BASIC USERS MANUAL OCTOBER 1976 Apple Computer Company. 770 Welch Rd., Palo Alto, CA 94304 (415) 326-4248 This is a PRELIMINARY manual. It will, most likley, contain errors, incorrect
More informationME 461 C review Session Fall 2009 S. Keres
ME 461 C review Session Fall 2009 S. Keres DISCLAIMER: These notes are in no way intended to be a complete reference for the C programming material you will need for the class. They are intended to help
More informationAr r ays and Pointer s
Ar r ays and Pointer s Using Bloodshed Dev-C++ Heejin Park Hanyang University 2 Introduction Arrays Multidimensional Arrays Pointers and Arrays Functions, Arrays, and Pointers Pointer Operations Protecting
More information1. In C++, reserved words are the same as predefined identifiers. a. True
C++ Programming From Problem Analysis to Program Design 8th Edition Malik TEST BANK Full clear download (no formatting errors) at: https://testbankreal.com/download/c-programming-problem-analysis-program-design-8thedition-malik-test-bank/
More informationSubroutines, Functions and Modules
Subroutines, Functions and Modules Subdividing the Problem Most problems are thousands of lines of code. Few people can grasp all of the details. Good design principle: Exhibit the overall structure in
More informationFORTRAN Basis. PROGRAM LAYOUT PROGRAM program name IMPLICIT NONE [declaration statements] [executable statements] END PROGRAM [program name]
PROGRAM LAYOUT PROGRAM program name IMPLICIT NONE [declaration statements] [executable statements] END PROGRAM [program name] Content in [] is optional. Example:- PROGRAM FIRST_PROGRAM IMPLICIT NONE PRINT*,
More informationReview of Important Topics in CS1600. Functions Arrays C-strings
Review of Important Topics in CS1600 Functions Arrays C-strings Array Basics Arrays An array is used to process a collection of data of the same type Examples: A list of names A list of temperatures Why
More informationBasics of Programming
Unit 2 Basics of Programming Problem Analysis When we are going to develop any solution to the problem, we must fully understand the nature of the problem and what we want the program to do. Without the
More informationProgramming Languages, Summary CSC419; Odelia Schwartz
Programming Languages, Summary CSC419; Odelia Schwartz Chapter 1 Topics Reasons for Studying Concepts of Programming Languages Programming Domains Language Evaluation Criteria Influences on Language Design
More informationISO/IEC JTC 1/SC 22/OWGV N 0220
ISO/IEC JTC 1/SC 22/OWGV N 0220 Draft Fortran Annex Date 24 August 2009 Contributed by Dan Nagle Original file name 09-258r1.txt Notes Replaces N0216 To: WG23 09-258r1 Subject: Draft Fortran Annex From:
More information