我浏览了几篇莎士比亚的文档,但我无法弄清楚如何让我的莎士比亚程序工作。
我尝试了以下方法:
Shakespeare, A Program.
Romeo, A young man.
Juliet, a young woman
Act I: A test of variables.
Scene I: The first scene.
[Enter Romeo and Juliet]
Hamlet: You are as stupid as a smelly big flower!
(这应该将 Juliet 设置为 4,因为有臭味 = *2,大 = *2,花 = 1)
Juliet: Proceed to Scene II.
[Exeunt]
Scene I: The second scene.
[Enter Romeo and Juliet]
Juliet: Am I better than you?
Romeo: If so, you are as intelligent as the square root of Juliet.
Romeo: Open your heart.
这应该返回 2,这是 Juliet 的值。不幸的是,这只会产生编译器错误。我究竟做错了什么?