Ada Programs
- ./Josephus/josephus.adb --
remove every ith member of a circular list
- ./access/name.adb --
with Ada.Text_IO;
- ./access/simple.adb --
with Ada.Text_IO, Ada.Integer_Text_IO;
- ./access/tree.adb --
preorder traversal of binary tree
- ./access/unbounded.adb --
illustrating access to String
- ./approx/approx.adb --
approximate string matching
- ./approx/main.adb --
main program for approximate string matching
- ./args/args.adb --
simple program illustraing use of command line package
- ./args/os.adb --
illustrate GNAT's hooks to underlying operating system
- ./array/a2.adb --
comparing 2D arrays and array of arrays
- ./array/array_test.adb --
procedure Array_Test is
- ./array/bounds.adb --
upper and lower bounds of strings
- ./array/cnst.adb --
small program showing constant arrays can't be changed
- ./array/compare.adb --
comparing arrays and array slices
- ./array/component.adb --
componentwise operations on boolean arrays
- ./array/concatenation.adb --
concatentation of arrays
- ./array/dim2.adb --
examples of two dimensional arrays
- ./array/dim3.adb --
average all the elements of a 3 dimensional array
- ./array/drill-find_next.adb --
separate (Drill)
- ./array/frequency.adb --
count, display character frequency in standard input
- ./array/index.adb --
two-dimensional arrays indexed by discrete types
- ./array/mult.adb --
program with matrix multiplication subprocedure
- ./array/passing.adb --
parameter-passing mechanism effects program
- ./array/reverse_list.adb --
get integers and reverse them (with attributes)
- ./array/reverse_list_1.adb --
get integers and reverse them
- ./array/simple.adb --
simple example of array declarations and access
- ./array/stats.adb --
compute average, standard deviation of array of values
- ./array/store.adb --
with Ada.Text_IO;
- ./array/sub.adb --
array attributes, operations, and slices
- ./array/tax.adb --
compute income tax using arrays of rates and tax bracktes
- ./array/test.adb --
program to test array type compatibility
- ./assert/binomial.adb --
compute the binomial coefficient
- ./assert/condition.adb --
pre- and post-conditions
- ./assert/main.adb --
pragma "Assert" in GNAT and exception information
- ./block/block.adb --
find min and max using the block statement
- ./bounded/bounded_strings.adb --
generic package implementing bounded-length strings
- ./bounded/bounded_strings.ads --
generic package implementing bounded-length strings
- ./bounded/sort_names.adb --
with Ada.Text_IO, Bounded_Strings;
- ./business/generic_selection_sort.adb --
sort array "List" in non-decreasing order using selection sort
- ./business/generic_selection_sort.ads --
sort array "List" in non-decreasing order using selection sort
- ./business/sort-get_data.adb --
get employee records from data file
- ./business/sort.adb --
sort employee records in a file by name, id, salary, or dept
- ./c/dir.adb --
with Interfaces.C, Interfaces.C.Pointers; use Interfaces;
- ./c/main.adb --
with Interfaces.C; use Interfaces;
- ./c/test.adb --
with Interfaces.C; use Interfaces;
- ./case/days.adb --
example use of the case statement
- ./case/grade.adb --
example use of the case statement
- ./case/parse.adb --
categorized characters of a file
- ./case/telephone.adb --
example use of the case statement
- ./char/char.adb --
get a character, write the character and its position
- ./complex/complex.adb --
package for complex numbers
- ./complex/complex.ads --
package for complex numbers
- ./complex/complex_main.adb --
program to read and write complex numbers
- ./complex/main.adb --
program to read and write complex numbers
- ./craps/craps.adb --
Play one game of craps, gambling game using two dice
- ./date/calendar_date.adb --
package with function for day of week
- ./date/calendar_date.ads --
package with function for day of week
- ./date/date.adb --
use "Calendar_Date" package to compute day of week for 11/20/1997
- ./date/friday.adb --
package "Ada.Calendar" used to see if today is friday
- ./date/today.adb --
print today's date using "Ada.Calendar" package
- ./derived/cnst.adb --
constants are not inherited by derived types
- ./derived/derived.adb --
type of derived subprograms
- ./dutch/dutch_flag.adb --
sort command-line string into three colors
- ./easter/easter.adb --
calculation of Easter in the Gregorian calendar
- ./easter/golden.adb --
compute Golden number for 1997 and several integer constants
- ./easy/assign.adb --
a few assignment statements
- ./easy/cond.adb --
some different "if" statements
- ./easy/grade.adb --
get student records from standard input and print some
- ./easy/hello.adb --
simple main program with string constants
- ./easy/io.adb --
get an integer and a float
- ./easy/main.adb --
procedure Main is
- ./easy/number.adb --
copy standard input to output and number the lines
- ./enum/day.adb --
a procedure illustrating enumeration types and IO
- ./enum/over.adb --
a procedure illustrating overloaded enumeration types
- ./enum/ski_wax.adb --
determine best ski wax given snow conditions
- ./euler/euler_phi.adb --
compute Euler's phi function, number of relatively prime
- ./euler/main.adb --
use a separately compiled function to compute Euler's phi function
- ./except/block.adb --
an Ada block using exception handling for input errors
- ./except/final.adb --
copy a file, character by character, to standard output
- ./except/fragment1.adb --
an Ada block declaring, raising, and handling exceptions
- ./except/fragment2.adb --
an Ada block declaring, raising, and handling exceptions
- ./except/main.adb --
compute the binomial coefficient
- ./except/occur.adb --
an example of exception occurrences and exception info
- ./except/over.adb --
catch overflow in multiplication function
- ./except/product.adb --
use exception handling to deal with overflow
- ./except/propagation.adb --
illustrate exception propagation
- ./except/question_10.adb --
a puzzle about exception handling
- ./except/question_10a.adb --
understand program without exception handling first
- ./except/read.adb --
use exception handling in an input validation loop
- ./except/simple_read.adb --
subranges, enumeration IO, predefined exception handling
- ./except/stack.adb --
underflow, overflow in stacks make good exceptions
- ./factor/factor.adb --
function and types for array of factors
- ./factor/factor.ads --
function and types for array of factors
- ./factor/main.adb --
compute some some numbers based on factorization of input
- ./for/countdown.adb --
count backwards from 10
- ./for/for_example.adb --
a procedure illustrating "for" loops
- ./for/formula.adb --
print a table of the sum 1..N of powers
- ./for/hobo.adb --
"Lazy Hobo Riddle" from Cohoon & Davidson
- ./for/main.adb --
a procedure illustrating for loops and ranges of arrays
- ./for/nested.adb --
print multiplication table using nested "for" loops
- ./for/pyramid.adb --
prints a pattern of letters in shape of pyramid
- ./for/pythagorean.adb --
search for pythagorean triples up to N
- ./for/simple_for.adb --
program illustrating simple "for" loops
- ./for/temperature.adb --
high and low temperatures over 24 hours
- ./for/triangle.adb --
with Ada.Text_IO, Ada.Integer_Text_IO;
- ./for/triples.adb --
-- triples.adb -- generate and print pythagorean triples
- ./fraction/fraction_package.adb --
fraction (rational numbers) package
- ./fraction/fraction_package.ads --
fraction (rational numbers) package
- ./fraction/main.adb --
program using package "Fraction_Package"
- ./fsm/traffic.adb --
with Ada.Text_IO, Ada.Integer_Text_IO; use Ada;
- ./fsm/vending.adb --
example finite state machine for vending machine
- ./gender/gender.adb --
simple dialog using "Put" for characters
- ./generic/gen_bin_search.adb --
generic procedure to do binary search
- ./generic/gen_bin_search.ads --
generic procedure to do binary search
- ./generic/main_search.adb --
find all words of command line in input stream
- ./generic/matrix_main.adb --
- ./generic/matrix_package_1.adb --
- ./generic/matrix_package_1.ads --
- ./generic/matrix_package_2.adb --
- ./generic/matrix_package_2.ads --
- ./generic/matrix_package_3.adb --
- ./generic/matrix_package_3.ads --
- ./generic/matrix_package_4.adb --
- ./generic/matrix_package_4.ads --
- ./generic/swap.adb --
generic procedure to exchange two variables
- ./generic/swap.ads --
generic procedure to exchange two variables
- ./generic/tree_main.adb --
with Tree_Package;
- ./generic/tree_package.adb --
with Ada.Text_IO, Ada.Integer_Text_IO;
- ./generic/tree_package.ads --
package Tree_Package is
- ./goto/alt.adb --
a version of "main.adb" without gotos
- ./goto/fun.adb --
a version of "main.adb" using a function
- ./goto/main.adb --
possibly reasonable use of "goto" statement
- ./group/main.adb --
example generic function invocation
- ./group/power.adb --
generic function for group exponentiation
- ./group/power.ads --
given a group, provide power function
- ./hide/hide.adb --
Ada program using a package for information hiding
- ./hide/pack.adb --
Ada package with a function
- ./hide/pack.ads --
Ada package with a function
- ./inh/inh.adb --
- ./inh/subclass.adb --
- ./integer/int.adb --
integer type, subtypes, and derived types
- ./integer/size.adb --
universal integer expressions and large integers
- ./integer/sub.adb --
subtypes
- ./integer/unn.adb --
integer type, subtypes, dervied types, universal named numbers
- ./integration/riemann.adb --
with Ada.Text_IO, Ada.Float_Text_IO;
- ./integration/simpson.adb --
with Ada.Text_IO, Ada.Float_Text_IO;
- ./integration/trapezoid.adb --
with Ada.Text_IO, Ada.Float_Text_IO;
- ./invariant/exp.adb --
compute exponentiation illustrating loop invariants
- ./invariant/factorial.adb --
compute factorial illustrating loop invariants
- ./invariant/multiply.adb --
multiplying integers illustrating loop invariants
- ./invariant/odd.adb --
multiplying integers illustrating loop invariants
- ./invert/invert.adb --
with Matrix_Package;
- ./invert/invert.ads --
with Matrix_Package;
- ./invert/main.adb --
with Matrix_Package, Matrix_IO, Invert;
- ./invert/matrix_io.adb --
with Matrix_Package;
- ./invert/matrix_io.ads --
with Matrix_Package;
- ./invert/matrix_package.adb --
package body Matrix_Package is
- ./invert/matrix_package.ads --
package Matrix_Package is
- ./io/copy.adb --
copy standard input to output numbering lines
- ./io/echo.adb --
copy a file, character by character, to standard output
- ./io/prompt.adb --
prompt for input, convert to degrees/minutes, and loop
- ./io/read_cd.adb --
read records from binary file
- ./io/write_cd.adb --
write records to binary file
- ./io/write_ints.adb --
write integers to binary file
- ./io/write_rec.adb --
write different types to binary file
- ./jotto/example.adb --
example program using Screen package
- ./jotto/jots.adb --
- ./jotto/screen.adb --
View ASCII terminal as 2D window using escape sequences
- ./jotto/screen.ads --
View ASCII terminal as 2D window using escape sequences
- ./jpl/jpl.adb --
with Ada.Text_IO, Ada.Command_Line;
- ./languages/discrete_set.adb --
generic package for sets of discrete elements
- ./languages/discrete_set.ads --
generic package for sets of discrete elements
- ./languages/translations-find_minimum.adb --
separate (Translations)
- ./languages/translations-get_data.adb --
separate (Translations)
- ./languages/translations.adb --
use sets to determine minimum number of languages
- ./list/list.adb --
generic data structure for lists
- ./list/list.ads --
generic data structure for lists
- ./list/main.adb --
with List;
- ./longup/longup.adb --
with Ada.Text_IO; use Ada.Text_IO;
- ./loop/coconuts.adb --
- ./loop/code.ads --
package Code is
- ./loop/decode.adb --
program illustrating nested loop/exit
- ./loop/encode.adb --
- ./loop/fact.adb --
an Ada program fragment computing the factorial of the input
- ./loop/previous.adb --
an Ada program fragment to count same values in input
- ./loop/print_lowest_divisor.adb --
a procedure illustrating "while"
- ./loop/reach_goal.adb --
a procedure illustrating "loop"/"exit"
- ./loop/temperature.adb --
high and low temperatures over 24 hours
- ./loop/zero_count.adb --
an Ada program fragment to count zero characters
- ./lower/lower.adb --
convert upper-case Latin-1 character to lower case
- ./lower/main.adb --
Ada program using several predefined libraries
- ./machine/machine_inventory-find_machine.adb --
separate (Machine_Inventory)
- ./machine/machine_inventory-new_machine.adb --
separate (Machine_Inventory)
- ./machine/machine_inventory.adb --
with Ada.Calendar, Ada.Direct_IO;
- ./matrix/main.adb --
transforming points using the package "Rigid_2D"
- ./matrix/rigid_2d.adb --
with Ada.Numerics.Elementary_Functions;
- ./matrix/rigid_2d.ads --
rigid 2D transformation using homogeneous coordinates
- ./mort/loan.adb --
program to print amortization table for given loan
- ./names/german_ordering.adb --
with
- ./names/go1.adb --
with
- ./names/go2.adb --
with
- ./names/i18n-get_input.adb --
separate (I18n)
- ./names/i18n-sort.adb --
separate (I18n)
- ./names/i18n.adb --
with Ada.Text_IO, Ada.Integer_Text_IO; use Ada;
- ./names/i18n_outline.adb --
with Ada.Text_IO;
- ./names/names.adb --
with Ada.Text_IO, Ada.Integer_Text_IO;
- ./names/spanish_ordering.adb --
function Spanish_Ordering (Left, Right: String) return Boolean is
- ./obese/obese.adb --
with Ada.Text_IO, Ada.Integer_Text_IO, Ada.Float_Text_IO;
- ./obese/robust.adb --
with Ada.Text_IO, Ada.Integer_Text_IO, Ada.Float_Text_IO;
- ./objects/main.adb --
with Objects, Shapes; use Objects, Shapes;
- ./objects/objects.adb --
with Ada.Numerics.Elementary_Functions;
- ./objects/objects.ads --
package Objects is
- ./objects/shape_main.adb --
tagged records and classwide procedures
- ./objects/shapes.adb --
with Ada.Numerics; use Ada.Numerics;
- ./objects/shapes.ads --
with Objects; use Objects;
- ./overload/example_1.adb --
illustrate overloaded subprocedures
- ./overload/example_2.adb --
illustrate overloaded functions
- ./overload/largest.adb --
demonstrate overloading in Ada from Cohen, page 287 ff
- ./overload/multiple.adb --
illustrate overloaded subprocedures
- ./overload/overload.adb --
demonstrate overloading in Ada
- ./overview/except.adb --
program outline illustrating exception handling
- ./overview/generic_stack.adb --
Ada generic package implementation for stack
- ./overview/generic_stack.ads --
Ada generic package specification for stack
- ./overview/instance.adb --
generic package instantiation
- ./overview/main.adb --
an examble main program
- ./overview/overload.adb --
an example of overloaded procedures
- ./overview/parallel.adb --
illustration of parallel execution
- ./overview/reverse_integers.adb --
use stacks to reverse input
- ./overview/stack_package.adb --
Ada package implementation for stack
- ./overview/stack_package.ads --
Ada package specification for stack
- ./overview/subclass.adb --
tagged records and classwide programming
- ./package/cd_package.ads --
CD information for reading and writing
- ./package/earth_orbit_data.ads --
common constants for earth orbit
- ./package/fibonacci_package.adb --
compute Fibonacci function using table lookup
- ./package/fibonacci_package.ads --
package to compute Fibonacci function
- ./package/junk.adb --
the body or implementation of the "Junk" package
- ./package/junk.ads --
the specification of the "Junk" package
- ./package/matrix_5.adb --
package body Matrix_5 is
- ./package/matrix_5.ads --
package Matrix_5 is
- ./package/quantities.ads --
common constants in octal
- ./package/random.adb --
-- A crude source of random numbers 0 .. 2**12 - 1
- ./package/random.ads --
-- A crude source of random numbers
- ./package/sign_integer_package.ads --
abstract type of sign/magnitude integers
- ./package/test.adb --
with Quantities, Ada.Numerics.Generic_Elementary_Functions;
- ./package/trig_tables.adb --
with Ada.Numerics.Elementary_Functions;
- ./package/trig_tables.ads --
package Trig_Tables is
- ./package/twos_integer_package.ads --
-- An abstract data type for signed integers using twos complement
- ./package/use_junk.adb --
a client of the "Junk" package
- ./pasta/pasta-ov.adb --
with Text_IO, Direct_IO;
- ./pasta/pasta.adb --
with Text_IO;
- ./quad/quadratic.adb --
given user inputs compute roots of quadratic equations
- ./record/cd.adb --
using Ada records to represent audio CD info
- ./record/line.adb --
compute equation for line given two points
- ./record/overload.adb --
records, record aggregates and subprogram overloading
- ./record/rational.adb --
define record and functions for rational numbers
- ./record/records.adb --
examples of hierarchical records, arrays of records
- ./record/simple_records.adb --
examples of records for complex numbers and dates
- ./record/vector.adb --
records used in defining 3d vectors
- ./record/zero_one.adb --
records with zero and one subcomponent
- ./recurse/ack.adb --
function Ack (M, N: Long_Long_Integer) return Long_Long_Integer is
- ./recurse/add.adb --
addition by recursion
- ./recurse/add2.adb --
addition by recursion, simple version
- ./recurse/binary_search.adb --
recursive search for an element in a sorted array
- ./recurse/combinations.adb --
-- Computes the number of combinations of size "Members" that
- ./recurse/display.adb --
with Ada.Text_IO;
- ./recurse/exponentiation.adb --
with Ada.Text_IO, Ada.Integer_Text_IO, Ada.Float_Text_IO;
- ./recurse/factorial.adb --
function Factorial (N: Natural) return Positive is
- ./recurse/fast.adb --
print a table of fast growing functions
- ./recurse/fib.adb --
with Ada.Text_IO, Ada.Integer_Text_IO;
- ./recurse/fractals.adb --
print fractal "landscape"
- ./recurse/hanoi.adb --
the classic Towers of Hanoi recursive program
- ./recurse/jeep.adb --
function Jeep (
- ./recurse/linear_search.adb --
recursive search for an element in an array
- ./recurse/main.adb --
with Jeep;
- ./recurse/split.adb --
a recursive function that splits in two
- ./recurse/tll.adb --
Traverse Linked List
- ./root/root.adb --
-- root.adb
- ./root/sqrt.adb --
-- This function calculates an approximation of the square root
- ./search/binary_main.adb --
binary search of array
- ./search/insert_main.adb --
procedure Insert_Main is
- ./search/lexicographic.adb --
is the string "Left" < "Right"?
- ./search/main.adb --
with Ada.Text_IO, Ada.Integer_Text_IO;
- ./search/match_main.adb --
with
- ./search/order.adb --
with Ada.Text_IO, Ada.Integer_Text_IO;
- ./search/test.adb --
with Ada.Text_IO, Ada.Command_Line, Lexicographic;
- ./ser/bendy.adb --
with Ada.Text_IO, Ada.Integer_Text_IO;
- ./ser/intersection.adb --
intersection of two line segments
- ./ser/intersection.ads --
intersection of two line segments
- ./ser/point.adb --
with Ada.Text_IO, Ada.Integer_Text_IO, Ada.Float_Text_IO;
- ./ser/point_main.adb --
with Ada.Text_IO, Ada.Integer_Text_IO, Point;
- ./ser/simple.adb --
determine if input sets are simple polygons
- ./ser/test.adb --
with Ada.Text_IO, Ada.Integer_Text_IO, Intersection;
- ./sort/main-insertion_sort.adb --
separate (Main)
- ./sort/main-selection_sort.adb --
separate (Main)
- ./sort/main.adb --
with Ada.Text_IO, Ada.Integer_Text_IO;
- ./square/square.adb --
compute square of input; check for valid input
- ./stack/postfix.adb --
read postfix expressions, evaluate and print result
- ./stack/unbounded_stack.adb --
with Unchecked_Deallocation;
- ./stack/unbounded_stack.ads --
generic data structure for stack
- ./stack0/bounded_stack.adb --
generic data structure for stack
- ./stack0/bounded_stack.ads --
generic data structure for stack
- ./stack0/integer_stack.adb --
data structure for stack of integer elements
- ./stack0/integer_stack.ads --
data structure for stack of integer elements
- ./stack0/main.adb --
instantiation of generic bounded stack
- ./string/main-binary_search.adb --
subunit to search for string in array
- ./string/main.adb --
use binary search to find command-line arg in word list
- ./string/read.adb --
read in array of bounded strings from standard input
- ./string/simple.adb --
illustrate string slices and character concatenation
- ./sub/abstraction.adb --
Ada program illustrating subprocedures
- ./sub/analyze_main.adb --
compute average, variance of an array in a subprocedure
- ./sub/concat_main.adb --
operatator overloading
- ./sub/correspondence.adb --
Ada program illustrating subprocedures
- ./sub/dog.adb --
subprocedure to replace "dog" by "cat"
- ./sub/example.adb --
Ada program illustrating subprocedures
- ./sub/formula.adb --
print the sum 1..N of powers 1, 2, 3, and 4
- ./sub/increment_list_main.adb --
procedure Increment_List_Main is
- ./sub/increment_main.adb --
a subprocedure with a default argument
- ./sub/largest_main.adb --
simple function used to compute magnitude
- ./sub/mode.adb --
procedure Look (X: in Integer) is
- ./sub/more_abstraction.adb --
Ada program illustrating functions
- ./sub/movie.adb --
illustrate default parameters
- ./sub/no_abstraction.adb --
Ada program illustrating subprocedures
- ./sub/psf.adb --
declare
- ./sub/repeat_main.adb --
illustrate default parameters
- ./sub/rewrite.adb --
declare
- ./sub/side.adb --
two unrelated blocks illustrating side effects
- ./task/protect.adb --
with Ada.Text_IO, Ada.Integer_Text_IO;
- ./task/serialize.adb --
with Ada.Text_IO, Ada.Integer_Text_IO, Ada.Float_Text_IO;
- ./task/update.adb --
with Ada.Text_IO, Ada.Integer_Text_IO;
- ./test/ints.adb --
read and write integers
- ./test/main.adb --
a while loop that divides an interval in thirds
- ./test/period.adb --
compute period of a pendulum
- ./test/repeated.adb --
get integers until one of them equals the previous one
- ./test/surface.adb --
lateral surface area of a right circular cone
- ./test/volume.adb --
compute volume of a right circular cone
- ./transactions/main-solution.adb --
with Transactions, Transactions.Deposits, Transactions.Checks, Transactions.Interest;
- ./transactions/main.adb --
tagged records types and inheritence
- ./transactions/transactions-checks.adb --
with Ada.Text_IO, Ada.Integer_Text_IO;
- ./transactions/transactions-checks.ads --
package Transactions.Checks is
- ./transactions/transactions-deposits.adb --
- ./transactions/transactions-deposits.ads --
with Ada.Strings.Unbounded;
- ./transactions/transactions-interest.adb --
with Ada.Text_IO, Ada.Float_Text_IO;
- ./transactions/transactions-interest.ads --
package Transactions.Interest is
- ./transactions/transactions.adb --
- ./transactions/transactions.ads --
- ./unbounded/unbounded_strings.adb --
generic package implementing unbounded-length strings
- ./unbounded/unbounded_strings.ads --
generic package implementing unbounded-length strings
- ./variant/insidious.adb --
function Insidious return String is
- ./variant/vr.adb --
procedure vr is
- ./vectors/triplets.adb --
type for triples; used as base type of vectors
- ./vectors/triplets.ads --
type for triples; used as base type of vectors
- ./vectors/vectors.adb --
3-dimensional vector package derived from Triplets
- ./vectors/vectors.ads --
3-dimensional vector package derived from Triplets
- ./visible/example_1.adb --
scope rules and subprocedures
- ./visible/example_2.adb --
scope rules and blocks
- ./visible/main.adb --
illustrate the visibility of subprograms
- ./visible/scope.adb --
example of lexical scoping
- ./weather/chill.adb --
Compute wind chill given wind speed and temerature
- ./weather/wet.adb --
with Ada.Text_IO, Ada.Float_Text_IO;
- ./words/score.adb --
compute "score" of words, print ever improving ones
Ryan Stansifer <ryan@cs.fit.edu>