2020-01-18 08:12:15 +00:00
|
|
|
let rec parse_and_print () =
|
|
|
|
print_string "Entier ? > ";
|
|
|
|
flush stdout;
|
|
|
|
input_line stdin |> function
|
|
|
|
| "q" | "Q" -> ()
|
|
|
|
| "h" | "?" | "H" ->
|
2020-01-18 08:27:11 +00:00
|
|
|
print_endline "Je n'accepte que des entiers positifs. Et pas trop grands…\n'q' ou 'Q' pour quitter.";
|
2020-01-18 08:12:15 +00:00
|
|
|
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 ()
|