September 8th.

Slides:



Advertisements
Similar presentations
Introduction to arrays
Advertisements

Fortran 4- Reading and Writing from Data Files Chapter 4 of your Fortran book.
Chapter 2 Basic Elements of Fortan
Formatted Output What we know: write(*,*) x print *, x General Form: write (unit, format, options) list unit = * : write to the monitor format = *: no.
CS241 PASCAL I - Control Structures1 PASCAL I - Control Structures Philip Fees CS241.
Testing a program Remove syntax and link errors: Look at compiler comments where errors occurred and check program around these lines Run time errors:
Fortran- Subprograms Chapters 6, 7 in your Fortran book.
1 Project 5: Median. 2 The median of a collection of numbers is the member for which there are an equal number less than or equal and greater than or.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved Streams Streams –Sequences of characters organized.
Class 3 Programming in Visual Basic. Class Objectives Learn about input/output Learn about strings Learn about subroutines Learn about arrays Learn about.
Input, Output, and Processing
Lecture 2: Introduction to C Programming. OBJECTIVES In this lecture you will learn:  To use simple input and output statements.  The fundamental data.
Some Fortran programming tips ATM 562 Fall 2015 Fovell (see also PDF file on class page) 1.
Visual Basic 2010 How to Program © by Pearson Education, Inc. All Rights Reserved.
Visual Basic 2010 How to Program © by Pearson Education, Inc. All Rights Reserved.1.
CS241 PASCAL I - Control Structures1 PASCAL Control Structures Modified Slides of Philip Fees.
1 CS161 Introduction to Computer Science Topic #8.
1 Homework Done the reading? –K&R –Glass Chapters 1 and 2 Applied for cs240? (If not, keep at it!) Gotten a UNIX account? (If not, keep at it!)
Chapter 8 Arrays. A First Book of ANSI C, Fourth Edition2 Introduction Atomic variable: variable whose value cannot be further subdivided into a built-in.
Higher Computing Science 2016 Prelim Revision. Topics to revise Computational Constructs parameter passing (value and reference, formal and actual) sub-programs/routines,
Why Repetition? Read 8 real numbers and compute their average REAL X1, X2, X3, X4, X5, X6, X7, X8 REAL SUM, AVG READ *, X1, X2, X3, X4, X5, X6, X7, X8.
CPS120 Introduction to Computer Science Exam Review Lecture 18.
1 Types of Programming Language (1) Three types of programming languages 1.Machine languages Strings of numbers giving machine specific instructions Example:
Chapter 16 Advanced Bourne Shell Programming. Copyright © 2005 Pearson Addison-Wesley. All rights reserved. Objectives To discuss numeric data processing.
FILES AND EXCEPTIONS Topics Introduction to File Input and Output Using Loops to Process Files Processing Records Exceptions.
CCSA 221 Programming in C CHAPTER 3 COMPILING AND RUNNING YOUR FIRST PROGRAM 1 ALHANOUF ALAMR.
C++ Exceptions.
Topics Designing a Program Input, Processing, and Output
User-Written Functions
Functions and Subroutines
Chapter 7 Pointers and C-Strings
CSC 201 Computer Programming- FORTRAN
Computer Programming BCT 1113
© 2016 Pearson Education, Ltd. All rights reserved.
Programming Fundamental
Programming For Nuclear Engineers Lecture 6 Arrays
Chapter 10: Void Functions
CS1010 Programming Methodology
Introduction to C Language
Objectives Identify the built-in data types in C++
Introduction to C++.
Scripts & Functions Scripts and functions are contained in .m-files
JavaScript: Functions.
Stacks Chapter 4.
Stack Data Structure, Reverse Polish Notation, Homework 7
Programming in C Input / Output.
Chapter 10: Pointers 1.
Programming in C Input / Output.
Chapter 2 - Introduction to C Programming
Topics Introduction to File Input and Output
Chapter 14 - Advanced C Topics
Midterm Review Programming in Fortran
4.9 Multiple-Subscripted Arrays
Web DB Programming: PHP
Topics Designing a Program Input, Processing, and Output
Homework Applied for cs240? (If not, keep at it!) 8/10 Done with HW1?
Lecture 3 : January 2001 Dr. Andrew Paul Myers
PL/SQL Declaring Variables.
mdul-cntns-sub-cmmnts2.f90
Topics Designing a Program Input, Processing, and Output
Intro to Programming Concepts
Topics Designing a Program Input, Processing, and Output
Variables in C Topics Naming Variables Declaring Variables
C++ Array 1.
Topics Introduction to File Input and Output
Introduction to C Programming
REPETITION Why Repetition?
Announcements.
P 72 (PDF 76) Figure 32 Information item name Rules in columns
Presentation transcript:

September 8th

Logical operators .AND. .OR. .NOT.

“error handling” Reaching the end of data on input ICOUNT = 0 5 READ (5,222, END = 72) X ICOUNT = ICOUNT + 1 222 FORMAT(I5) GOTO 5 72 WRITE (6, 91) ICOUNT 91 FORMAT (1X, ‘ The number of values read is ‘, I10) END = ERR = label

Helpful hints If input is coming from the keyboard (as in this class), end of file is indicated by a <ctrl> z Suppose you have an executable called assign2.exe One way to run it is to type assign2 <return> Input will come from the keyboard Alternatively, you can type assign2 < some_filename Input will come from some_filename Output, by default comes to the screen but you can redirect it to a file using assign2 > output.txt assign2 >> output.txt

Statement Functions General Form Example Function name (argument list) = expression Example AREA(SIDE1,SIDE2,ANGLE) = 0.5*SIDE1*SIDE2*SIN(ANGLE) Sample Calls AREA1 = AREA(X,Y,Z) AREA2 = AREA (A,B,C)

FORTRAN arrays General form Example Stored in column major order DIMENSION array1(size),array2 (sizeA,sizeB) Example DIMENSION ALPHA (10,15),BETA (12) REAL X(10), INTEGER NUMBER(2,3) Stored in column major order Can be passed as parameters but need to pass in size.

Early FORTRAN’s array only capable of holding numbers FORTRAN arrays start at 1 Array subscripts are surrounded by parentheses

Reserved words???? Is it legal to say END = 5.9 DO = 5 IF = 27

Is there a maximum integer? Minimum integer is X = -2147483648