Ada
The Towers of Hanoi as an Ada program.
Ada is a modern programming language designed to support sound software engineering principles and practices. The Ada language is the result of the most extensive and most expensive language design effort ever undertaken. Today, Ada is an internationally standardized, general-purpose programming language used in a wide variety of applications -- from missile control to payroll processing to air traffic control. Ada encourages good programming practices by incorporating software engineering principles with strong typing, modularity, portability, reusability and readability. These features reduce costs in software development, verifying, debugging, and maintenance that typically puts strain on an organization's resources over the life of the software.
More information on Ada can be found on www.adahome.com.
--
-- The Towers Of Hanoi
-- Ada
-- Copyright (C) 1999 Amit Singh. All Rights Reserved.
-- http://hanoi.kernelthread.com
--
N: constant INTEGER := 3;
procedure hanoi(n, from, to, using: in integer);
begin
if (n = 1) then
put("move "); put(from);
put(" --> "); put(to);
new_line;
else
hanoi(n - 1, from, using, to);
hanoi(1, from, to, using);
hanoi(n - 1, using, to, from);
end if;
end hanoi;
procedure main is
begin
hanoi(N, 1, 3, 2);
end main;