CPE 101 Programming

 University of Sheffield,

Department of Chemical and Process Engineering

Module Leader: Dr WBJ Zimmerman



The textbook for the course is

L. Nyhoff and S. Leestma, FORTRAN 77 For Engineers and Scientists with an Introduction to FORTRAN 90, Prentice-Hall International, 4th edition, 1996, 29.99.

It should be available at Blackwell's (Mappin Street). Readings and exercises are assigned from the book. CPE 201 (Computing) also uses this book as a reference. The textbook provides the module narrative. Lectures and lecture notes are not intended to be a complete guide to FORTRAN programming, but to demonstrate many features.

Quick Guide to FORTRAN Computing

This module has been taught by Dr VN Sharifi for several years. Her course notes are available here as a hypertext book from the above link. Please note that none of the tutorial exercises in this Quick Guide are required for the module now. The description of how the PC computing/networking works for FORTRAN programming is now out-of-date and should be ignored.

Electronic FORTRAN guidebook

Clive G. Page of the University of Leicester has made his out-of-print FORTRAN guidebook

Professional Programmer's Guide to FORTRAN 77

Available on-line. Download the postscript file prof77.ps. You can view the book on a PC using the ghostview application.

Computer Laboratory

The computer laboratory sessions (bi-weekly for each group) are intended to work as help-sessions. Demonstrators will be available to answer questions.

Homework Assignments

Homework assignments are due at the end of lecture, one week after being assigned. There are no extensions granted. It is intended that assignments will be marked promptly and model answers available from this website. Each week deliberately has a large number of exercises to encourage the student to dig into the material. There is no examination, nor final project. The assessment is 100% coursework.

Link to the Community Programming Library

Nyhoff and Leestma has many FORTRAN programming examples which enrich the learning experience -- if you type the source code in, compile, and run them. This is a chore for any individual programming example, let alone the entire textbook. So let's do it together! Each individual member of the class will be the owner of at least one programming example. He or she types in the source code and compiles it to make sure there are no syntax errors. When the owner is satisfied that the code is OK, he or she attaches it to an e-mail message to me, W.Zimmerman@shef.ac.uk, whereupon I post it for downloading on the Community Programming Library. All other classmates can then download the source code, compile it, and run it on their own computers, as they read along in the textbook. Since you only have to type in the programming example for which you are the owner, but have the benefit of forty- odd other students typing efforts, you may use the textbook in an interactive way, as it was intended, with minimal work.

Link to the Web FORTRAN Resources

Syllabus/Timetable Spring 1999-2000





Supplementary Material

Week 1


Data Types, Arithmetic, Assignment, Input/Output

NL Chapter 1

NL 2.1, 2.2, 2.3, 2.4, 2.5

NL p.52:




NL p.59:


NL p. 65:


Lecture 1 Notes

Model Answers 1

Notes: Average score was 25/31. Model answers are corrected, 15-2-00.

Week 2


Program Format, Programming Example, File I/O, Roundoff Errors, Logical expressions

NL 2.6, 2.9, 2.10, 2.11

NL 3.1

NL p.106ff:


NL pp. 126-7:


 Model Answers 2

Week 3

Branching Structures

IF statement, Nested IFs, IF-ELSE IF, Programming Example, Logical Data Type, Logic Circuits

NL 3.2, 3.4, 3.5, 3.6, 3.7

NL pp.158-160:


NL pp. 166-168:


NL pp. 173-5:


Model Answers 3


lecture notes

Week 4


Do Loops

"Do While"


Least-Squares Line

NL Chapter 4

NL pp. 190-1:


NL pp. 225-229:


NL p.235:


NL pp. 248-9:

19, 21

Model Answers 4

Week 5


Formatted I/O, File Processing

NL 5.1, 5.2, 5.3, 5.4, 5.5

NL pp. 279-281:

1,5,9,13,17,21,25,29, 33

NL pp. 308-310:


Model Answers 5

Week 6

Function Subprograms

Library and User-defined Functions, Numerical Integration, Functions as Arguments

NL 6.1, 6.3, 6.5

NL pp. 333-4:


NL pp. 362-369:


NL pp. 377-385:


Model Answers 6

Week 7

Subroutine Subprograms

Heading, Call, Passing Arguments, Local Variables, Common Blocks

NL 7.1, 7.3, 7.4, 7.6

NL pp. 409-410:


NL pp. 460-466:

16, 21

Model Answers 7

Note that the random number generator on p. 420 fails. Use the function ran2 in the file random.f instead.

For normally distributed random numbers use normld.f 

Week 8

Arrays (1-D)

Sorting and Searching

NL 8.1, 8.2, 8.3, 8.4, 8.5, 8.8, 8.10

NL pp.490-492:


NL pp.507-509:


NL pp.545-553:


Model Answers 8

Week 9

Arrays (n-D)

Matrix Processing, Gaussian Elimination

NL 9.1, 9.2, 9.5, 9.6, 10.1

NL pp. 578-581:


NL pp.595-597:


NL pp. 605-608:


NL p.619:


Model Answers 9