!c*****   ELABORADO POR FERNANDO LAROCA
!C****       CALCULA AS FUNCOES TRIGONOMETRICAS
!C*****    DE ANGULOS DADOS EM GRAUS.

  Program func_trigonom

    Implicit none 


    Real*8                        :: seno     ! seno p/ angulos em graus.

	Real*8                        :: cosseno  !	 cosseno   ""

	Real*8                        :: tang     !  tangente  ""

	Real*8                        :: angrad   ! angulo em radianos

    Real*8                        :: alfa     ! angulo em graus

	Integer                       :: i,j      ! variáveis contadoras

	Real*8                        :: X(4)     ! vetor p/ armaz. func. trigonetricas

    alfa = 0.d0

	open(7,file='trigon.txt',form='formatted' )

    do i = 1, 36

	  X(1) = angrad(alfa)

	  X(2) = seno(alfa)

	  X(3) = cosseno(alfa)

	  X(4) = tang(alfa)

	  write(7,10) alfa, ( X(j), j = 1,4)

	  alfa = alfa + 10.d0

	enddo

10  format ( 5x, F6.2, 4(1pE12.4) )

    End Program

!C*************************************************************************
!C****     CONVERTE GRAUS EM RADIANOS
!C*************************************************************************
	Real*8 Function angrad(beta)

	  Implicit none

	  Real*8                        :: beta    ! angulo em graus

      Real*8                        :: pi

	  pi = dacos(-1.d0)

	  angrad = beta * pi / 180.d0

	  return
	  
	End Function


!C*************************************************************************
!C****     CALCULA  SENO
!C*************************************************************************

	Real*8 Function seno(beta)

	  Implicit none

	  Real*8                        :: beta    ! angulo em graus

	  Real*8                        :: angrad  ! angulo em rad


	  seno = dsin( angrad(beta) )

	End Function

!C*************************************************************************
!C****     CALCULA COSSENO
!C*************************************************************************
	Real*8 Function cosseno(beta)

	  Implicit none

	  Real*8                        :: beta    ! angulo em graus

	  Real*8                        :: angrad  ! angulo em rad


	  cosseno = dcos( angrad(beta) )

	End Function

!C*************************************************************************
!C****     CALCULA TANGENTE
!C*************************************************************************
	Real*8 Function tang(beta)

	  Implicit none

	  Real*8                        :: beta    ! angulo em graus

	  Real*8                        :: seno    !
	   
	  Real*8                        :: cosseno !


	  tang = seno(beta) / cosseno(beta)

	End Function


!	  Logical                 ::  chamada
					   
!      chamada = systemqq('notepad ENTRADA.TXT')

!      int4 = setexitqq(qwin$exitnopersist)

!      Tcpu = timef()  ! na primeira chamada liga um relógio.  Nas chamadas seguintes
                       !   o valor corrente em segundos é atribuído.



