在 Fortran 程序中,可以使用 WRITE 语句将变量输出到命令行。例如:

program test
  implicit none
  integer :: x, y
  x = 10
  y = 20
  write(*,*) 'x = ', x
  write(*,*) 'y = ', y
end program test

在命令行中运行该程序,将输出:

x =           10
y =           20

其中,星号 (*) 表示输出到标准输出设备,逗号 (,) 表示输出后不换行。

如何在 Linux 下使用 Fortran 程序将变量输出到命令行

原文地址: https://www.cveoy.top/t/topic/mYGK 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录