6

我浏览了几篇莎士比亚的文档,但我无法弄清楚如何让我的莎士比亚程序工作。

我尝试了以下方法:

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 的值。不幸的是,这只会产生编译器错误。我究竟做错了什么?

4

2 回答 2

11

一开始,你只定义了罗密欧与朱丽叶,有2个场景I。我认为你的意思是

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]
Romeo: <<This is important, because Hamlet is not defined!
You are as stupid as a smelly big flower!
Juliet: Proceed to Scene II.
[Exeunt]  

Scene II: The second scene. <<You need to change it to Scene II!
[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.
[Exeunt]

这应该返回 2。

于 2014-11-26T02:20:58.410 回答
1

此外,如果要为下一个场景带回所述角色,则编译器通常不会在场景结束时让所有角色出现。此外,“进入场景 2 是不必要的(但它很有帮助)。例如

Juliet: Proceed to Scene II

Scene II: The second scene.
....
于 2015-10-23T13:04:33.063 回答