Revision: 4-28-09
Introduction
In my last semester of college, I decided to take a class in Fortran programming just for fun (because who really uses Fortran anymore). The following is a collection of the projects I completed during said class; they range from simple I/O programs to data structure manipulation programs. Documentation for these programs is also provided where available. All programs were compiled using Absoft's Fortran compiler for Windows, and as such I can only guarantee successful compilation on that platform. If you've had success or failure with other compilers, please send me a note regarding it.
I'm mainly making this code available because I was appalled by the lack of Fortran examples there are on the web. If you need further help with the language, I'd recommend obtaining a copy of the Fortran 90 Handbook (ISBN 0070004064); it's particularly useful when trying to figure out the archaic I/O and formatting options.
Projects
-
Arithmetic #1
Files: Code
Simple program that adds two numbers then outputs
-
Arithmetic #2
Files: Code
Simple program that adds and subtracts two numbers then outputs
-
Pythagorean Triples
Files: Code
Calculates Pythagorean Triples from input given
-
Triangle Perimeter and Area
Files: Code
Calculates triangle perimeter and area from input given
-
Triangle Validity and Typing
Files: Code
Determines from given input whether a triangle is valid or not and, if so, what its type is (i.e. equilateral, isosceles, or scalene)
-
Fibonacci with Do Loops
Files: Code
Outputs X number of terms in the Fibonacci Sequence
-
Fibonacci with Do Loops continued
Files: Code
Same as the last program except that output is formatted and also contains the ratio between two terms
-
First 10 Partial Sums of 1/k!
Files: Code
Outputs the first ten partial sums of the series 1/k! (1 divided by k factorial) with formatting
-
Multiplication and Division Formatting
Files: Code
Outputs the product, quotient, and remainder of the given input with heavy formatting
-
Bacterial Growth
Files: Code
Calculates the population of bacteria given a certain starting count and growth rate
-
Student Record GPA Calculator with File I/O
Files: Code
Reads a data file of student course records and writes a file with calculated GPA
-
Round Function
Files: Code
Uses a custom round function to output some rounded test numbers
-
Prime Test Function
Files: Code
Tests if the given input number is a prime number using a custom function
-
Perfect Square Test Function
Files: Code
Tests if the given input number is a perfect square using a custom function
-
L-Grid Path Counter
Files: Code | Doc
Recursively finds the number of paths through an L-shaped grid (square grid with an area removed from the upper right) from the upper left to the bottom right
-
Drunkard's Walk
Files: Code | Pseudo-code | Doc
Calculates several statistics for X runs of the Drunkard's Walk algorithm
-
Shell Sort
Files: Code | Doc
Creates a random array of numbers and then uses a shell sort subroutine to sort them
-
Magic Square
Files: Code
Uses a recursive function to generate a Magic Square
-
Angle Class
Files: Test Program | Class Module | Doc
Tests a class (or the best equivalent to a class in Fortran) for working with angle data, which includes operator overloads and constructors
-
Random Binary File
Files: Main Program | Random Number Module | Doc
Writes an array of random numbers to both a text and binary file
-
Random Binary File Reader
Files: Code | Doc
Outputs every 100th record from a binary file (typically created with the previous program)
-
Random Binary File Search
Files: Code | Doc
Looks for records in a binary file that match the given input
-
Queue Class
Files: Test Program | Class Module | Doc
Tests a class that implements a queue--uses pointers, of course
-
Huffman Encoding/Decoding
Files: Source Archive | Library Module | Doc
A series of test programs that call subprograms in a library module to perform the various steps of Huffman Encoding: counting the number of character occurances, building a tree, encoding, and decoding. (Unfortunately, the decoding portion wasn't completed due to end-of-semester time constraints.)
Complete Download
All the source code and documentation from this page is available in the following archive:
fortran_source.zip