FORTRAN语言问题,求大神讲解~
PROGRAMMAINIMPLICITNONEREAL::X,C,F,EINTEGER::IOPEN(1,FILE='MYF2.DAT')OPEN(2,FILE='MYF...
PROGRAM MAIN
IMPLICIT NONE
REAL::X,C,F,E
INTEGER::I
OPEN(1,FILE='MYF2.DAT')
OPEN(2,FILE='MYF2.OUT')
DO I=1,7
READ(1,*)X,C
E=F(X,C)
WRITE(*,'(2F6.2,F9.5)')X,C,E
WRITE(2,'(2F6.2,F9.5)')X,C,E
ENDDO
END PROGRAM
FUNCTION F(X,C) RESULT(S)
IMPLICIT NONE
REAL::EPS,S,UN,X,C
INTEGER::N
EPS=1E-10
S=0.0
N=1
DO
UN=COS(((2.0*N-1)*3.1415926*X/C)/(2.0*N-1.0)**2.0)
IF (ABS(UN)<EPS) EXIT
S=S+UN
N=N+1
ENDDO
S=SQRT(C*3.1415926**2.0/2.0/X-4.0*C/X*S)
END FUNCTION
运行以后出现forrtl: severe (59): list-directed I/O syntax error, unit 1, file C:\Program Files\DevStudio\MyProjects\MYF2.DAT错误。为什么?该怎么解决? 展开
IMPLICIT NONE
REAL::X,C,F,E
INTEGER::I
OPEN(1,FILE='MYF2.DAT')
OPEN(2,FILE='MYF2.OUT')
DO I=1,7
READ(1,*)X,C
E=F(X,C)
WRITE(*,'(2F6.2,F9.5)')X,C,E
WRITE(2,'(2F6.2,F9.5)')X,C,E
ENDDO
END PROGRAM
FUNCTION F(X,C) RESULT(S)
IMPLICIT NONE
REAL::EPS,S,UN,X,C
INTEGER::N
EPS=1E-10
S=0.0
N=1
DO
UN=COS(((2.0*N-1)*3.1415926*X/C)/(2.0*N-1.0)**2.0)
IF (ABS(UN)<EPS) EXIT
S=S+UN
N=N+1
ENDDO
S=SQRT(C*3.1415926**2.0/2.0/X-4.0*C/X*S)
END FUNCTION
运行以后出现forrtl: severe (59): list-directed I/O syntax error, unit 1, file C:\Program Files\DevStudio\MyProjects\MYF2.DAT错误。为什么?该怎么解决? 展开
2个回答
展开全部
错误问题是数据文件MYF2.DAT不在 C:\Program Files\DevStudio\MyProjects\下
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询