-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhyoka.ml
29 lines (26 loc) · 1.26 KB
/
hyoka.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
type gakusei_t = {
namae : string;
tensuu : int;
seiseki : string;
}
let hyoka gakusei = match gakusei with
{namae = n; tensuu = t; seiseki = s} ->
{namae = n; tensuu = t; seiseki = if t >= 80 then "A"
else if t >= 70 then "B"
else if t >= 60 then "C"
else "D"}
(* test *)
let test1 = hyoka {namae = "asai" ; tensuu = 90 ; seiseki = ""}
= {namae = "asai" ; tensuu = 90 ; seiseki = "A"}
let test2 = hyoka {namae = "asai" ; tensuu = 80 ; seiseki = ""}
= {namae = "asai" ; tensuu = 80 ; seiseki = "A"}
let test3 = hyoka {namae = "asai" ; tensuu = 75 ; seiseki = ""}
= {namae = "asai" ; tensuu = 75 ; seiseki = "B"}
let test4 = hyoka {namae = "asai" ; tensuu = 70 ; seiseki = ""}
= {namae = "asai" ; tensuu = 70 ; seiseki = "B"}
let test5 = hyoka {namae = "asai" ; tensuu = 65 ; seiseki = ""}
= {namae = "asai" ; tensuu = 65 ; seiseki = "C"}
let test6 = hyoka {namae = "asai" ; tensuu = 60 ; seiseki = ""}
= {namae = "asai" ; tensuu = 60 ; seiseki = "C"}
let test7 = hyoka {namae = "asai" ; tensuu = 55 ; seiseki = ""}
= {namae = "asai" ; tensuu = 55 ; seiseki = "D"}