summaryrefslogtreecommitdiff
path: root/tigrou/use-an-array/use-an-array.tih
diff options
context:
space:
mode:
Diffstat (limited to 'tigrou/use-an-array/use-an-array.tih')
-rw-r--r--tigrou/use-an-array/use-an-array.tih12
1 files changed, 12 insertions, 0 deletions
diff --git a/tigrou/use-an-array/use-an-array.tih b/tigrou/use-an-array/use-an-array.tih
new file mode 100644
index 0000000..55a7d5a
--- /dev/null
+++ b/tigrou/use-an-array/use-an-array.tih
@@ -0,0 +1,12 @@
+type int_array = array of int
+function max_search(a : int_array, size : int) : int =
+ if size <= 0 then -1
+ else
+ let
+ var maxi := 0
+ in
+ (for i := 1 to size - 1 do
+ if a[maxi] < a[i] then
+ maxi := i);
+ maxi
+ end