发布于:2007-02-26 10:47:26
来自:水利工程/水文与水资源工程
[复制转发]
fortran 中输出语句,一行当中要输出多个数据
如
program lili
implicit none
integer::i
open(1,file=’12’,status=’old’)
i=1
do
write(1,’(i5)’)I
i=i+1
if(i>180)then
exit
endif
enddo
close(1)
end program
不要在i5前加重复系数,好像可以在write(1,’(i5)’)I的I后面加符号的,怎么加阿
全部回复(10 )
只看楼主 我来说两句subroutine sub5
implicit none
real::dms,ghs,vvv
integer::i,n,t1,t2,t,j
real,dimension(1:999)::A,B,C,e,f,g
integer::k,s,d2
Open(1,file=’JSCG’,status=’old’)
Open(2,file=’JSCGB5’,status=’old’)
read(1,*)N, DMS, GHS, VVV
I=1; K=0
do
read(1,*)T;T1 =Int(T/3600); T2 =(T-T1 * 3600) / 60
do J=1,2 * DMS; read(1,*)A(j); enddo
do J=1,GHS; read(1,*)A(j),B(j); enddo
do J=1,VVV; read(1,*)A(j)
If (A(j)==0) cycle
read(1,*)B(j),C(j)
S=1
do
If (A(S)==A(j).And.B(S)==B(j).And.C(S)==C(j))Then
D2=1 ;exit ;endif
d2=2
If (A(S)==0)Then
write(2,’(" 倒 堤 时 刻: ",i4," 时 ",i2, " 分 ")’)T1,T2
write(2,’(" 倒 堤 湖 泊 序 号: ",f4.0," 倒 堤 上 断 面 序 号: ",f4.0," 倒 堤 宽 度: ",f6.2," 米")’)A(j),B(j),C(j)
K=K+1; e(K)=A(j); f(K)=B(j);g(K)=C(j)
exit
endif
s=s+1
enddo
enddo
If (I==N ) exit
I=I+1
enddo
Close(1); do I=1,5; write(2,*); enddo
end subroutine sub5
回复 举报
basic语言代码如下:
1720 OPEN "JSCG" FOR INPUT AS #1
1721 OPEN "JSCGB" FOR OUTPUT AS #2
1730 INPUT #1,N,DMS,GHS,VVV
1740 CLS
1750 I=1:K=0
1760 INPUT #1,T:T1=INT(T/3600):T2=(T-T1*3600)/60
1770 FOR J=1 TO 2*DMS:INPUT #1,A:NEXT J
1780 FOR J=1 TO GHS:INPUT #1,A,B:NEXT J
1790 FOR J=1 TO VVV:INPUT #1,A
1800 IF A=0 THEN 1910
1810 INPUT #1,B,C
1820 S=1
1830 IF A(S)=A AND B(S)=B AND C(S)=C THEN D2=1:GOTO 1870
1840 D2=2
1850 IF A(S)=0 THEN 1870
1860 S=S+1:GOTO 1830
1870 IF D2=1 THEN 1910
1880 PRINT #2, " 倒 堤 时 刻: ";T1;" 时 ";T2;" 分 ";
1890 PRINT #2, " 倒 堤 湖 泊 序 号: ";A;" 倒 堤 上 断 面 序 号: ";B;" 倒 堤 宽 度: ";C;" 米"
1900 K=K+1:A(K)=A:B(K)=B:C(K)=C
1910 NEXT J
1920 IF I=N THEN 1930 ELSE I=I+1:GOTO 1760
1930 CLOSE #1:CLEAR:FOR I=1 TO 5:PRINT #2, :NEXT I:GOTO 200
回复 举报