Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (**
- compiled with
- ocamlopt ascii.ml -o ascii
- or
- ocamlopt.opt.exe ./ascii.ml -o ./ascii.exe
- *)
- let () =
- Printf.printf "oct | dec | hex | char%10soct | dec | hex | char\n" " "
- let () =
- let to_char_string = function
- 127 -> "DEL"
- | i -> i |> char_of_int |> Char.escaped
- in
- for i = 32 to 80 do
- let p = Printf.printf "%3o %3d %3X %4s\t\t%3o %3d %3X %4s\n" i i i (char_of_int i |> Char.escaped) in
- let i = i + 47 in
- p i i i (i |> to_char_string)
- done
- let () = flush stdout
- let _ = input_char stdin
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement