sppk.net
当前位置:首页 >> FortrAn怎样读取txt文件里面两列数据? >>

FortrAn怎样读取txt文件里面两列数据?

REAL X(100),Y(100) OPEN(12,FILE='123.TXT') DO I=1,100,1 READ(12,100) X(I),Y(I) ENDDO 100 FORMAT(F5.2,1X,F5.2) 说明:123为你txt文档名字 txt中数据时有要求的,你给的数据有个别不满足要求,如 4.50 5.00应该改成 4.50 5.00也就是说要改成整...

首先你要看有多少行多少列。 不妨,按照你的例子,比如有10行,2列 开头写上行数,列数10,2 之后就是你的数组 然后代码如下: program mainimplicit noneINTEGER m,n,iREAL,ALLOCATABLE:: a(:),b(:)OPEN(8,FILE="a.txt")READ(8,*)m,n !n=2ALLOCA...

字符串处理本就不是fortran的强项。此问题用pascal很容易,程序如下: var f1,f2:text; s,s1,s2:string; p1,p2:integer; begin assign(f1,'test.txt'); reset(f1); assign(f2,'test.out'); rewrite(f2); while not eof(f1) do begin readln(f1,s...

Open( 12 , File = 文件名 ) Do i = 1 , 行数 Read( 12 , * ) a(i) , b(i) End Do Close( 12 )

Program www_fcode_cn Implicit None Real :: a , b , c Integer :: ierr Open( 12 , File = "1.txt" ) Open( 13 , File = "2.txt" ) Open( 14 , File = "3.txt" ) Do Read( 12 , * , iostat = ierr ) a , b if ( ierr /= 0 ) Exit Read( 13 , *...

integer :: i = 2 , j = 3 , k = 4 write( * , '(3g0)' ) i , j , k

① 代码{F90}: program array_assignment integer, dimension (3, 6) :: c integer, dimension (3, 2) :: b1, b2, b3 data b1/1,2,3,4,5,6/, b2/10,20,30,40,50,60/, b3/100,200,300,400,500,600/ c(:,1:2) = b1 c(:,3:4) = b2 c(:,5:6) = b3 ...

网站首页 | 网站地图
All rights reserved Powered by www.sppk.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com