所以,我在使用MARIE模拟器时遇到了一个问题。这里是提示:我不知道为什么这个MARIE SIM代码不能正常工作
define a decimal variable X and set X = 0
define a decimal variable Y and set Y = 0
Input a number in decimal form from the keyboard
store the number in location X
Input a number in decimal form from the keyboard
store the number in location Y
If X > 0, then
X = X + 5
Else
X = Y - 2
Endif
Display X using the output instruction
编辑:当前的代码:
org 100
input
store X
input
store Y
load X
skipcond 800
Jump Else
load X
Add A
store X
jump Endif
Else, load Y
Subt B
store X
Endif, Load X
Output
Halt
X, dec 0
Y, dec 0
A, dec 5
B, dec 2
我的问题来自于一个事实,当你运行它,数学不出来正确。例如,如果你输入4代表X,那么答案应该是7,当它是9时。任何人都可以指出我出错的地方吗?
不幸的是,它遭受着与我目前相同的问题。 if的X部分很好,但是如果去到else,输出总是2,不管Y的输入是什么。 – Monobus 2014-11-05 03:39:34
你在输入什么内容和输入的结果?当我输入4为x和10为它在我的女友模拟输出9。当我为x输入-5,然后输入7为Y mt时,十进制输出为5.您是否正确保存并确保更新了以前的代码,或者尝试创建一个新的空白编辑并粘贴我发布并保存和组装的内容那么,然后测试我提供的输入,看它是否相同。 – Chef 2014-11-05 17:38:38
尽快尝试直接copyong,只要我到我的电脑。 – Monobus 2014-11-05 21:09:42