【发布时间】:2017-10-18 23:27:48
【问题描述】:
所以我的 TI-84 计算器上有一个程序可以计算 3-D 形状的体积。这是代码
ClrHome
Disp "Z=Cuboid
Disp "Y=Tri Prism
Disp "X=Square Pyramid
Disp "W=Tri Pyramid
Disp "V=Cylinder
Disp "U=Cone
Disp "T=Sphere
Prompt S
Pause
If S=Z
Then
Prompt W,L,H
W*L*H→θ
ClrHome
Disp "V=
Disp θ
Pause
ClrHome
Stop
End
If S=Y
Then
Prompt A,B,C,H
*formula*→θ
ClrHome
Disp "V=
Disp θ
Pause
ClrHome
Stop
End
If S=X
Then
Prompt H,L,W
*formula*→θ
ClrHome
Disp "V=
Disp θ
Pause
ClrHome
Stop
End
这是我现在的整个程序,问题是当我将 S 的值输入为 X,(S=X) 并按 Enter 键继续时,程序进入 If S=Y 并询问我 A, B、C 和 H。如果我输入 S=Z,那么程序转到 S=Z 没问题。如果我输入 S=Y,程序进入 S=Y 没问题。但是当我输入 S=X 时,程序进入 S=Y。为什么?
【问题讨论】:
标签: conditional ti-basic