[問題] 複數陣列
我想要定義一個複數陣列,
分別可以知道此陣列元素的實部跟虛部,
底下是我的code
program simple
implicit none
complex matrix(3,3)
integer :: i,j
real :: b,x,y
complex :: a
b=0.5
a=(sin(b),cos(b))
do i=1,3
do j=1,3
matrix(i,j) = a
end do
end do
write(*,*) matrix(2,2)
end program simple
錯誤訊息如下,
a=(sin(b),cos(b))
^
pathf95-197 pathf90: ERROR SIMPLE, File = simple.f90, Line = 10, Column = 12
Unexpected syntax: ")" was expected but found ",".
pathf95: PathScale(TM) Fortran Version 2.5 (f14) Fri Jul 23, 2010 18:07:48
pathf95: 19 source lines
pathf95: 1 Error(s), 0 Warning(s), 0 Other message(s), 0 ANSI(s)
pathf95: "explain pathf95-message number" gives more information about each
message
這樣的定義法好像是不行的,請有經驗的前輩告訴我該怎麼處理。
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 174.20.210.146
推
07/24 11:08, , 1F
07/24 11:08, 1F
→
07/24 12:09, , 2F
07/24 12:09, 2F
Fortran 近期熱門文章
PTT數位生活區 即時熱門文章