[Fortran] 纯文本查看 复制代码
PROGRAM sislincom
IMPLICIT NONE
PARAMETER (IPATH=1,LDA=40,n=40)
INTEGER,PARAMETER::ne=40
INTEGER,PARAMETER::nsal=40
COMPLEX a(LDA,LDA),b(n),x(n)
OPEN(nsal,FILE='RESULT.SAL')
WRITE (nsal,'(A/35("=")/)')
CALL erset (0, 0, 0)
OPEN(ne,FILE='DATO.TXT')
WRITE (ne,'(A/35("=")/)')
!LECTURA DE DATOS
i=o
DO
i=i+1
READ(ne,'(6X,4F8.1)',END=40) datos(i,1:n)
ENDDO
CONTAINS
SUBROUTINE sistema
INTEGER code, tipo
INTEGER, EXTERNAL:: iercd, n1rty
CALL dlsacg (n, a, LDA, b, IPATH, x)
code = iercd()
tipo = n1rty(1)
IF (code == 0) THEN
WRITE (nsal,'(/A,3F10.6)') 'Sistema compatible: x = ', x
ELSE
WRITE (nsal,'(/A,I2)') 'Error en la resolucion code = ', code
IF (code == 2) WRITE (nsal,'(A)') 'Matriz singular'
IF (tipo == 4) WRITE (nsal,'(A)') 'Error fatal'
ENDIF
ENDSUBROUTINE sistema
ENDPROGRAM sislincom