calc02.f90

Path: calc02.f90
Last Update: Sun Mar 09 23:12:10 JST 2008

Required files

Methods

calc  

Included Modules

integral

Public Instance methods

Main Program :

integral モジュールにより台形公式を用いた数値積分を行う 主プログラムです.

This procedure input/output NAMELIST#nml .

[Source]

program calc
  !
  ! integral モジュールにより台形公式を用いた数値積分を行う
  ! 主プログラムです. 
  !
  use integral, only: trapezoid
  integer :: ios
  real    :: a ! 積分区間の下限
  real    :: b ! 積分区間の上限
  integer :: n ! 積分区間の分割数
  namelist /nml/ a, b, n
               !
               ! 積分区間に関して入力を行うための NAMELIST 変数群名です. 
               !
  write(*,*) ' Input interval (a,b) and division number (n) like'
  write(*,*) '   "nml a=0, b=10, n=100 /"'
  read(*, nml, iostat = ios)
  if ( ios == 0 ) then
    s = trapezoid(a,b,n)
    write(*,*) s
  else
    write(*,*) '  Error: input data is invalid.' 
     stop
  end if
end program calc

[Validate]