Fortran 读取语句
新手问题,但我在任何地方都找不到一些好的 Fortran 文档。
我正在研究一个程序,作者使用读取语句来评估用户是否想要重新运行脚本。
代码是:
PRINT *,'Calculate again? .TRUE./T/t -> yes , .FALSE./F/f -> no'
READ *,answer
然后它使用逻辑变量answer来选择程序下一步要转到哪里。
上面的代码做了什么?
Newbie question, but I can't find some good fortran documentation anywhere.
I am studying a program and the writer uses a read statement to evaluate if the user wants to rerun the script.
The code is:
PRINT *,'Calculate again? .TRUE./T/t -> yes , .FALSE./F/f -> no'
READ *,answer
Then it uses the logical variable answer to select where does the program have to goto next.
What does the code above do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
可能应该是
READ *,answer
从标准输入单元读取answer。代码输出“再次计算?.TRUE./T/t -> yes , .FALSE./F/f -> no”,然后读入
answer
,我认为它被声明为逻辑变量。有关 Fortran 95 的文档,请参阅 http://en.wikipedia.org/wiki/Fortran_95_language_features。
Probably it is supposed to be
READ *, answer
to read answer from the standard input unit.The code outputs "Calculate again? .TRUE./T/t -> yes , .FALSE./F/f -> no" then reads into
answer
, which I suppose is declared as a logical variable.See http://en.wikipedia.org/wiki/Fortran_95_language_features for documentation of Fortran 95.
MSB是对的,我只是添加了评论中不适合的内容。
互联网上有大量优秀的 Fortran 资源。您可以使用官方标准,但通常更好的是编译器的文档。这个 http://publib.boulder.ibm.com/infocenter/comphelp/v111v131/index.jsp?topic=%2Fcom.ibm.xlf131.aix.doc%2Flanguage_ref%2Fassociatestmt.html非常好。
此外还有大量的课程和教程。只需谷歌“Fortran 初学者课程”、“Fortran 教程”或类似内容即可。
M.S.B is right, I just add what did not fit into a comment.
There are tons of good Fortran resources on the internet. You can use official standard, but better are usually documantation for compilers. This one http://publib.boulder.ibm.com/infocenter/comphelp/v111v131/index.jsp?topic=%2Fcom.ibm.xlf131.aix.doc%2Flanguage_ref%2Fassociatestmt.html is very good.
Also there are numerous courses and tutorials. Just google "Fortran beginner course", "Fortran tutorial" or similar.