fortran实战手册(4)

发布时间 2023-11-24 15:25:14作者: 水宝石

数组

笛卡尔积

aid a1 a2bid b1 b2
  1 66 74  1 76 84
  2 89 79  1 76 84
  1 66 74  2 99 59
  2 89 79  2 99 59

Process returned 0 (0x0)   execution time : 0.167 s
Press any key to continue.
program learn
    implicit none
    integer,dimension(2,3)::a
    integer,dimension(2,3)::b
    integer::i,j
    a=reshape([1,2,66,89,74,79],[2,3])
    b=reshape([1,2,76,99,84,59],[2,3])
    write (*,120) 'aid','a1','a2','bid','b1','b2'
    write (*,110) ((a(i,:),b(j,:),i=1,2),j=1,2)
    110 format (6(I3))
    120 format (6(A3))
end program learn