我需要用“用例”,但我不明白怎么用。我必须做一个读一个月数的程序,这个程序给出这个月有多少天。但当我输入任何数字时,说我的对象xxx在不适用。有人能帮我吗?
(clear)
(display "Ingrese Un numero de Mes: ")
(define mes (read))
(if (and (integer? mes)(>= mes 1)(<= mes 12))
(case (mes)
((4 6 9 11)(display 30))
((1 3 5 7 8 10 12) (display 31))
(else (display 28 ))
)
)
发布于 2015-03-26 17:05:14
你的括号太多了。应该是(case mes ...)
,而不是(case (mes) ...)
。它不像C风格的switch
。:-)
https://stackoverflow.com/questions/29284017
复制相似问题