| 照猫画虎还不会? 
 
 [Fortran] syntaxhighlighter_viewsource syntaxhighlighter_copycode Module S
  Interface Operator (.U.)
    Module Procedure Addy
  End Interface Operator (.U.)
Contains
  Function Addy(C1, C2)
    Implicit None
    Integer, Intent (In) :: C1(:), C2(:)
    Integer :: Addy(20)
    Integer :: Arry1(20), Arry2(20)
    Integer I, Len
    Logical :: Flg(20)
    Len = Size(C1)
    Arry1 = -1
    Do I = 1, Len
      Arry1(C1(I)) = C1(I)
    End Do
    Len = Size(C2)
    Arry2 = -2
    Do I = 1, Len
      Arry2(C2(I)) = C2(I)
    End Do
    Addy = -3
    Flg = All(Arry1.Eq.Arry2)
    Print *, Flg
    Addy = Merge(Arry1, Addy, Flg)
  End Function Addy
End Module S
Program Main
  Use S
  Implicit None
  Interface
    Subroutine Random_arr(A)
      Implicit None
      Integer (Kind=4), Intent (Out), Allocatable :: A(:)
    End Subroutine Random_arr
  End Interface
  Integer, Allocatable :: A(:)
  Integer, Allocatable :: B(:)
  Integer Lena, Lenb
  Call Init_random_seed()
  Call Random_arr(A)
  Call Random_arr(B)
  Lena = Size(A)
  Lenb = Size(B)
  Print *, 'A'
  Write (*, 10) A
  Print *, 'B'
  Write (*, 10) B
  10 Format (20I3)
End Program Main |