{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

8Procedures

# 8Procedures - Procedure Top-down design Procedures Internal...

This preview shows pages 1–6. Sign up to view the full content.

Procedure 1-1- Top-down design. Procedures: Internal External External Procedure Subroutines Functions

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Why?? 2-2- PROGRAM find_sin_cos IMPLICIT NONE REAL :: x, sinx WRITE(*,*) ‘enter x’ READ(*,*) x sinx = x – x**3/(3*2*1)+x**5(5*4*3*2*1)-x**7(7*6*5*4*3*2*1) cosx = 1 – x**2/(2*1)+x**4(4*3*2*1)-x**6(6*5*4*3*2*1) WRITE(*,*) ‘Approximate sin value is’, sinx WRITE(*,*) ‘Approximate cos value is’, cosx END PROGRAM find_sin_cos
Why?? 3-3- Improved Readability, Better Organization Independent testing of each substasks Reusable code Reduced side effects

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Subroutines 4-4- Fortran procedure invoked by CALL statement Receives input and returns output through an argument list SUBROUTINE subroutine_name (argument_list) …declaration statement …execution statement RETURN END SUBROUTINE [name]
Subroutines 5-5- Argument list: List of variables passed from the calling program. Dummy argument: no memory in subroutine.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 14

8Procedures - Procedure Top-down design Procedures Internal...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online