Ada Code Examples
MC logo
 

Ada Code Examples

CSc 233 Ada Home Page


Examples from lecture.

Basic examples, Control Structures, Basic Types.
o Hello, World!
o Using GNAT I/O
o Numeric constants and expressions
o Simple Subrange Types and Subtypes
o Enumerated Types
o I/O With Enumerated Types
o Calculator Program

Arrays.
o Basic Arrays
o Primes by Seive
o Array Aggregates
o Two-Dimensional Array
o Array of Arrays
o Array Slicing
o Skip and Read
o Simple Record Use

Functions and Procedures.
o Simple Function 1
o Simple Function 2
o Operator Overloading
o Skip and Read 2
o In and Out Parameters.
o Default and Keyword Parameters.
o Function Overloading.

Access Types (Pointers).
o Simple Linked List.
o Simple Linked List With Disposal.
o Skip and Read 3
o Rules for all pointers
o Function Access

Packages
Simple Stack Package.
o Integer Stack Package Specification
o Integer Stack Package Body
o Integer Stack Demonstration Client

Rational Numbers.
o Rational Number Package Spec
o Rational Number Package Body
o Rational Number Example Client

Linked Stack Package.
o Linked Stack Package Specification
o Linked Stack Package Body
o Linked Stack Client

Reversable Stack (Derived).
o Reversable Stack Child Package
o Reversable Stack Child Body
o Reversable Stack Client

Wanderer.
o Wanderer Package
o Wanderer Package Body
o Wanderer Package Separate Function
o Wanderer Client

Renaming.
o Function Rename 1
o Function Rename 2

Objects.
o Objects 1

Sequence Generator Inheritance Heirarchy.
o Sequnce Abstract Class
o Sequnce Class Body
o Computational Sequence Class
o Computational Sequence Class Body
o Additive Sequence Class
o Additive Sequence Class Body
o Multiplicative Sequence Class
o Multiplicative Sequence Class Body
o Listing Sequence Class
o Listing Sequence Class Body
o Polymorphic Driver

Object-Oriented Generalized Stack.
o OO Generalized Stack Package
o OO Generalized Stack Body
o OO Integer Stack Package
o OO Integer Stack Body
o OO String Stack Package
o OO String Stack Body
o OO Stack Driver

Exceptions.
o EOF Exception Example
o Data Exception Example
o Data Exception with Continuation Example
o Integer Stack with Exceptions
o Integer Stack with Exceptions Body
o Integer Stack with Exceptions Client

Parameterized Types and Generics.
o Linked List of Strings
o General Stack Package
o General Stack Body
o General Stack Client
o Variant Record