diff options
| author | Martial Simon <msimon_fr@hotmail.com> | 2025-09-15 01:07:58 +0200 |
|---|---|---|
| committer | Martial Simon <msimon_fr@hotmail.com> | 2025-09-15 01:07:58 +0200 |
| commit | 967be9e750221ab2ab783f95df79bb26d290a45e (patch) | |
| tree | 6802900a5e975f9f68b169f0f503f040056d6952 /tigrou/use-an-array/use-an-array.tih | |
Diffstat (limited to 'tigrou/use-an-array/use-an-array.tih')
| -rw-r--r-- | tigrou/use-an-array/use-an-array.tih | 12 |
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 |
