Sample Programs used in the course
- Summing a series up to n terms
- Find the n-th 235 number
- Version 1 of Bubble sort
- Version 2 of Bubble sort
- Reversing a number
- 2-d array- finding row with max sum
- Using a Function to get input within bounds
- Version 1 of Knight's walk on Chessboard
- Version 2 of Knight's walk on Chessboard
- Binary to Decimal conversion
- Hexadecimal to Decimal conversion
- 3 simple demos using PGPLOT (x^2, sin(x)/x, ...)
- Knight's tour using PGPLOT
- Here is the code series1.f90
and series2.f90 for the example on
passing functions as arguments. To compile, do
f90 -o series series1.f90 series2.f90
- Here is the code 101mod.f90 defining
cs101student derived type
and 101sort.f90 for sorting
and 101main.f90 the main program
for calling sort by various criteria. A sample data file
101data.lst is here.
To compile, do
f90 -o 101test 101mod.f90 101sort.f90 101main.f90
- Here is the code gui.f90 (GUI module) and
the main.f90 used to set up buttons with
a sample gui.cfg file. To compile use this
file mypgcompile (save this in mypgcompile) and
do the following:
chmod +x mypgcompile
./mypgcompile -o guitest gui.f90 main.f90
- Here is the code ngui.f90 (new GUI module) and
the guiread.f90 used to for INPUT buttons with
a sample guiread.cfg file. To compile use this
file mypgcompile (save this in mypgcompile) and
do the following:
chmod +x mypgcompile
./mypgcompile -o guiread ngui.f90 guiread.f90
- Here is the code for pointers. The file
simple1.f90 shows how to create lists
simple2.f90 shows how to delete elements, and
llist.f90 is from Chapman and reads in a list of
real numbers from a file.
-
code for generating permutations perm.f90
-
Recursive function for fib and fact are defined in
fact.f90 and the file
qsort.f90 implements quicksort of an array.
-
Binary Search Subroutine is defined in
bsearch.f90 and the file
msort.f90 implements mergesort of an array.