编写与 Fortran 程序等效的 Java 程序
我在 fortran 中有类似的东西。
20: call TESTBEGIN(a,b,c)
if(c<1) goto 40
30: call TESTMIDDLE(e,f,g)
if(g==1) goto 20
40: return
但我的代码是这样的
Subroutine testCase()
20: CALL beginTest(a,b)
IF (b.EQ.-1) GOTO 999
30: CALL middleTest(c,b)
IF (b.EQ.-1) GOTO 20
40: CALL endTest(d,b)
IF (b.EQ.-1) GOTO 30
CALL LastTest(e,b)
IF (.b.EQ.-1) GOTO 40
DO I =1,j
DTEMP(j)=1.0
END DO
some code
999:return
I have something like this in fortran.
20: call TESTBEGIN(a,b,c)
if(c<1) goto 40
30: call TESTMIDDLE(e,f,g)
if(g==1) goto 20
40: return
But my code is like this
Subroutine testCase()
20: CALL beginTest(a,b)
IF (b.EQ.-1) GOTO 999
30: CALL middleTest(c,b)
IF (b.EQ.-1) GOTO 20
40: CALL endTest(d,b)
IF (b.EQ.-1) GOTO 30
CALL LastTest(e,b)
IF (.b.EQ.-1) GOTO 40
DO I =1,j
DTEMP(j)=1.0
END DO
some code
999:return
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
类似的事情?
对于第二个代码片段,尝试使用状态机:
或者更好地尝试重新考虑算法,我认为您可以使用 Java 使其更容易阅读和理解。
Something like that?
For the second code snippet try a state machine:
Or better try to reconsider the algorithm, I think you could do it more easy to read and understand using Java.