fortran77 - Merging arrays in Fortran 77 -


i have 2 arrays: a = [1 2 3 4] , b = [5 6 7 8]. how can merge & b 1 array, c, , sort c in ascending order? need in fortran 77.

here naive implementation of concatenation/sorting algorithm:

    program sort     integer size1, size2, sizeout     parameter (size1 = 4, size2 = 4)     parameter (sizeout = size1 + size2)     integer in1(size1), in2(size1)     data in1/1,2,4,4/, in2/5,8,7,5/     integer out(sizeout)  c concatenate arrays      j=1,size1       out(j)=in1(j)     enddo     j=1,size2       out(j+size1)=in2(j)     enddo  c sort elements of output array  4  j=2,sizeout        if(out(j).lt.out(j-1))           temp    =out(j-1)           out(j-1)=out(j  )           out(j  )=temp           goto 4        endif     enddo      end 

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -