Exécutable : nbr.exe

This commit is contained in:
Matthieu Dubuget committed 2020-01-18 09:12:15 +01:00
1 parent 1569132c6c
commit 7529a7ed15
4 files changed
+21

No files matched your search

+3
View File
@@ -0,0 +1,3 @@
(executable
(name nbr)
(libraries nombres))
+18
View File
@@ -0,0 +1,18 @@
let rec parse_and_print () =
print_string "Entier ? > ";
flush stdout;
input_line stdin |> function
| "q" | "Q" -> ()
| "h" | "?" | "H" ->
print_endline "Je n'accepte que des entiers. 'q' ou 'Q' pour quitter.";
flush stdout;
parse_and_print ()
| str ->
str |> int_of_string
|> (fun i ->
match i with
| i -> i |> Nombres.nombre_of_int |> print_endline
| exception _ -> ())
|> parse_and_print
let () = parse_and_print ()
View File
File renamed without changes.
View File
File renamed without changes.