module read_data_module interface read_data module procedure read_integer module procedure read_real end interface contains subroutine read_real(file_name,raw_data,how_many) implicit none character (len=*), intent (in) :: file_name integer, intent (in) :: how_many real, intent (out), dimension (:) :: raw_data integer :: i open (file=file_name,unit=1) do i = 1, how_many read (unit=1,fmt=*) raw_data(i) end do end subroutine read_real subroutine read_integer(file_name,raw_data,how_many) implicit none character (len=*), intent (in) :: file_name integer, intent (in) :: how_many integer, intent (out), dimension (:) :: raw_data integer :: i open (file=file_name,unit=1) do i = 1, how_many read (unit=1,fmt=*) raw_data(i) end do end subroutine read_integer end module read_data_module module sort_data_module interface sort_data module procedure sort_integer module procedure sort_real end interface contains subroutine sort_real(raw_data,how_many) implicit none integer, intent (in) :: how_many real, intent (inout), dimension (:) :: raw_data call quicksort(1,how_many) contains recursive subroutine quicksort(l,r) implicit none integer, intent (in) :: l, r integer :: i, j real :: v, t i = l j = r v = raw_data(int((l+r)/2)) do do while (raw_data(i)j) exit end do if (lj) exit end do if (l