vault backup: 2023-09-05 19:44:03

This commit is contained in:
Louis Gallet 2023-09-05 19:44:03 +02:00
parent 78e00883ea
commit f64974be80
Signed by: lgallet
SSH Key Fingerprint: SHA256:qnW7pk4EoMRR0UftZLZQKSMUImbEFsiruLC7jbCHJAY

View File

@ -51,10 +51,13 @@ val stammer: int -> int = <fun>
## Exercice 2.6 ## Exercice 2.6
```Ocaml ```Ocaml
let sef_of_time h m s = let sec_of_time h m s =
h*3600 + m*60 + s ;; h*3600 + m*60 + s ;;
let time_of_sec s = let time_of_sec s =
let hours = s/3600 and minutes = s mod 60 and seconds = s mod 3600 in (hours, minutes, seconds) let hours = s/3600 in let minutes = (s - hours*3600)/60 in let seconds = s - hours *3600 - minutes * 60 in (hours, minutes, seconds);;
let add_times h1 m1 s1 h2 m2 s2 =
let sec1 = sec_of_time(h1 m1 s1) and sec2 = sec_of_time(h2 m2 s2) in let resultsec = sec1 + sec2 in time_of_sec(resultsec) ;;
``` ```