fortran语言里a(1)和a(2),代表什么意思啊,有什么区别啊?

 我来答
你猜我猜哇擦猜
2016-01-27 · TA获得超过2.8万个赞
知道大有可为答主
回答量:2万
采纳率:0%
帮助的人:6565万
展开全部
I was so surprised to find there is still the one who makes fortran language alive!!!
That's good news for me at least.
I am here to try fortran 95 to explain your question (assumed you use this version other rather 77) under linux OS environment.
For more detail in I/O statement, fortran documentation is always a good place to give it a go!

[open] ---> open a file called 'out' and mark it as integer 1.
[write] ---> write a string 'input: m' into file 'out' supposed, despite 1 should replace *.
[read] ---> read the content from your target file, which is supposed to be file marked as 1

for the sake of better understanding fortran I/O statement, I wrote a sample code combined with above command.

program write4read
implicit none
!
integer, parameter :: n=4;
integer :: i;
integer, dimension(1:n) :: a;
!
open(unit=10,file='data.txt',status='old')
! |
! |--- file status
! |--- existed file

open(unit=20,file='data-copy.txt',status='new')
! |
! |--- file status
! |--- new file
do i=1,n
read(10,100) a(i)
! read 'data.txt'
!
write(20,100) a(i)
! write a(i) into 'data-copy.txt'

print*, a(i)
! print a(i) on terminal screen
!
100 format (I3)
enddo
!
close(10)
! close 'data.txt'
!
close(20)
! close 'data-copy.txt'
!
end program write4read
Before you run this code, just ensure you save 'data.txt' file in the same directory of this fortran code.
'data.txt'

123
234
345
456
The running result should display as
本回答被网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
gcbjoy
2016-01-26 · TA获得超过1.1万个赞
知道大有可为答主
回答量:1.1万
采纳率:92%
帮助的人:2087万
展开全部
a是数组,a(1)、a(2)分别是数组a的第一、二个元素。
追问
iold=0是什么意思
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式