2 Sample programs


Overview

This chapter shows a few simple programs to give the 'feel' of an Ada program.


Simple programs

One of Ada's major philosophies is encapsulation. All of the standard I/O routines come presupplied in packages that can be included in a program. The following examples use the text_io package.

Unlike C which has a function main, and Pascal which has a program, any parameterless procedure can be a "main" routine. The procedure thus designated is chosen at link time.

Inputting numbers requires the use of a package devoted to the task. A package to do this exists with all Ada implementations. Other simpler packages are often created within a site (see package simple_io in the appendices).


to the index...