[Fortran] 纯文本查看 复制代码
program main
implicit none
CALL QW
c(1:N,1:N)=a(:,:)
c(1:N,N+1:2*N)=b(:,:)
c(N+1:2*N,1:N)=b(:,:)
c(N+1:2*N,N+1:2*N)=a(:,:)
write(*,*) c
end program main
SUBROUTINE QW
integer, parameter :: N=4
integer,dimension(N,N) :: a
integer,dimension(N,N) :: b
integer,dimension(2*N,2*N) :: c
integer :: i,j
do i=1,N
do j=1,N
a(i,j)=1
end do
end do
do i=1,N
do j=1,N
b(i,j)=2
end do
end do
END SUBROUTINE QW
[Fortran] 纯文本查看 复制代码
program main
implicit none
integer, parameter :: N=4
integer,dimension(N,N) :: a,b
integer,dimension(2*N,2*N) :: c
CALL QW(a,b)
c(1:N,1:N)=a(:,:)
c(1:N,N+1:2*N)=b(:,:)
c(N+1:2*N,1:N)=b(:,:)
c(N+1:2*N,N+1:2*N)=a(:,:)
write(*,*) c
contains
SUBROUTINE QW(a,b)
integer,dimension(:,:) :: a,b
a = 1
b = 2
END SUBROUTINE QW
end program main