<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><br />! A Program for testing sorting algorithms<br />! Filename: sort.f90 Src: JWW 10/2007<br />Â Â USE SORTMOD<br />Â Â Implicit NONE<br />Â Â integer, parameter :: n=80<br />Â Â integer :: i<br />Â Â real :: A(n)<br /><br />Â Â call random_number( A )<br /><br />Â Â call InsertionSort( A, n )<br /><br />Â Â do i=1,n<br />Â Â Â Â print *,i,A(i)<br />Â Â end do<br />end Program Sort<br /><br /><!--c2--></div><!--ec2--><br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><br />MODULE SORTMOD<br />Â Â IMPLICIT NONE<br />CONTAINS<br /><br />Â Â SUBROUTINE InsertionSort(B, m)<br />Â Â Â Â REAL, dimension) :: B !Dummy variable<br />Â Â Â Â INTEGER :: m<br />Â Â Â Â INTEGER :: i, j<br />Â Â Â Â REAL :: key<br /><br />m=80<br /><br />Â Â Â Â do j = 2, m<br />Â Â Â Â Â Â key = B(j)<br />Â Â Â Â Â Â i = (j - 1)<br />Â Â Â Â Â Â <br />Â Â Â Â Â Â do<br />Â Â Â Â Â Â Â Â Â Â if ((i>0) .AND. (B(i) > key)) exit<br />Â Â Â Â Â Â Â Â Â Â B(i+1) = B(i)<br />Â Â Â Â Â Â Â Â Â Â i = (i - 1)Â Â Â Â Â Â Â Â <br />Â Â Â Â Â Â enddo<br />Â Â Â Â <br />Â Â Â Â Â Â B(i + 1) = key<br />Â Â Â Â enddo<br /><br /><br />Â Â END SUBROUTINE InsertionSort<br />END MODULE SORTMOD<br /><br /><!--c2--></div><!--ec2--><br /><br /><br />Hey, The first part of code is the main program that was given to us that will genertate an array of random numbers. It calls the module to perform insertion sort. The second part is that module which I wrote. Everything compiles fine, but the program does nothing when run. It just gives me a cursor to type anything in (perhaps an infinite loop?) I really can't see where I went wrong here. Any tips?<br />
</div>
</div>