Fortran 读取语句

发布于 2025-01-02 04:47:20 字数 263 浏览 4 评论 0原文

新手问题,但我在任何地方都找不到一些好的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

生生不灭 2025-01-09 04:47:20

可能应该是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.

記柔刀 2025-01-09 04:47:20

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文