neelu09
Broken In
i need some help with ocaml programm...can anyone help
i have to write a programme which will tell whther a date is valid or not
i have written
let datevalid : int*string -> bool = function
(d,m) -> if (d>31 || d<1 || m<>"January"||m<>"February"||m<>"March"||m<>"April"||m<>"May"||m<>"June"||m<>"July"||m<>"August"||m<>"September"||m<>"October"||m<>"November"||m<>"December") then false
else if (d>28 && m="February") then false
else if (d=31 && (m<>"January"||m<>"March"||m<>"May"||m<>"July"||m<>"August"||m<>"October"||m<>"December")) then false
else true
;;
but this function gives false for valid dates also please help
i have to write a programme which will tell whther a date is valid or not
i have written
let datevalid : int*string -> bool = function
(d,m) -> if (d>31 || d<1 || m<>"January"||m<>"February"||m<>"March"||m<>"April"||m<>"May"||m<>"June"||m<>"July"||m<>"August"||m<>"September"||m<>"October"||m<>"November"||m<>"December") then false
else if (d>28 && m="February") then false
else if (d=31 && (m<>"January"||m<>"March"||m<>"May"||m<>"July"||m<>"August"||m<>"October"||m<>"December")) then false
else true
;;
but this function gives false for valid dates also please help
Last edited: