Posted: Sun Jun 06, 2004 4:24 pm Post subject: displaying guessed letters
Hey there, Help right now would be really appreciated! I'm getting very frustrated with this program. I want to output all the letters that have been guessed, but the only cin variable i have is guess and it just loops through asking for guess everytime. i've tried
Posted: Tue Jun 15, 2004 3:32 am Post subject: (No subject)
code:
(*
And just because I have too much time on my hands...
Read and report characters.
file: rrarc.ml
compile (on Windows) with: ocamlc rrarc.ml -o rrarc.exe
run as: rrarc <number of characters>
*)
open List
open Array
open Sys
let default_value = 26;;
let rec read_chars n =
let n = (abs n) in
match n with
0 -> []
| _ -> let ch = (read_line ()).[0] in ch :: (read_chars (n - 1));;
let _ =
let argv_len = (Array.length Sys.argv) in
let char_num = (try (int_of_string Sys.argv.(1)) with _ -> default_value) in
let char_list = (read_chars char_num) in
List.map print_char char_list;;