- 积分
- 0
- 注册时间
- 2005-3-21
- 仿真币
-
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2005-7-9 16:55:23
|
显示全部楼层
来自 北京
Re:读文件问题?!
发现read(unit,'(/n)')语句错误,read(unit,'(n/)')也是语句错误.
看我的程序:
program main
double precision a(6), b(3)
open(1,file='input.txt')
open(2,file='result.txt')
do i=1,3 %次数有问题. 有六(3的2倍,别的也一样)行未读.从第7行开始读的. 怎么改才能从第7行开始读??
read(1,'(/)')
enddo
do i=1,2
read(1,*)(a(j),j=1,6)
read(1,*)(b(j),j=1,3)
write(2,*) (a(j),j=1,6)
write(2,*)(b(j),j=1,3)
enddo
close(1)
close(2)
end
input.txt:
NEQ,NX,NY,NSTEN
3 20 53 4
COEF. MATRIX CC(NEQ*NEQ,(NXX+2)*(NYY+2))
((CC(K,I,J),K=1,9),I=1,im+2),j=1,jm+2)
1. 0. 0. 0. 1. 0. 0. 0. 1.
1. 0. 0. 0. 1. 0. 0. 0. 1.
1. 0. 0. 0. 1. 0. 0. 0. 1.
51.7351588 -0.0237233664 -0.000252668768 -0.0237233664 49.6040083 0.
-0.000252668768 0. 3859.02479
51.7257063 -0.0237674169 -0.000253089232 -0.0237674169 49.6042068 0.
-0.000253089232 0. 3845.3221
0. 0. 0.
0. 0. 0.
52.7351588 -1.0237233664 -1.000252668768 -1.0237233664 48.6040083 1.
-1.000252668768 1. 4859.02479
52.7257063 -1.0237674169 -1.000253089232 -1.0237674169 48.6042068 1.
-1.000253089232 1. 4845.3221
result.txt
1.00000000000000 0.000000000000000E+000 0.000000000000000E+000
0.000000000000000E+000 1.00000000000000 0.000000000000000E+000
51.7351588000000 -2.372336640000000E-002 -2.526687680000000E-004
-2.526687680000000E-004 0.000000000000000E+000 3859.02479000000
51.7257063000000 -2.376741690000000E-002 -2.530892320000000E-004
-2.530892320000000E-004 0.000000000000000E+000 3845.32210000000 |
|