大家幫忙看看Fortran中這個錯誤是什麼?怎麼改? open(1,file='data.txt') \x09real h,v,a,t,f,v0,g,H0 \x09f=0.03 \x09t=0.1 \x09g=9.8 \x09H0=100 \x09a=g \x09h=0 \x09v=0 \x09v0=sqrt(g/f) \x09do while(hv0)then \x09write(*,“(1x,F3.4)”)v0 \x09else \x09write(*,“(1x,F3.4)”)v \x09end if \x09end do \x09end \x09 錯誤如下 F:\fortran hui\Text1.for(2):Error: A specification statement cannot appear in the executable section. real h,v,a,t,f,v0,g,H0 --------^ Error executingdf.exe.

大家幫忙看看Fortran中這個錯誤是什麼?怎麼改? open(1,file='data.txt') \x09real h,v,a,t,f,v0,g,H0 \x09f=0.03 \x09t=0.1 \x09g=9.8 \x09H0=100 \x09a=g \x09h=0 \x09v=0 \x09v0=sqrt(g/f) \x09do while(hv0)then \x09write(*,“(1x,F3.4)”)v0 \x09else \x09write(*,“(1x,F3.4)”)v \x09end if \x09end do \x09end \x09 錯誤如下 F:\fortran hui\Text1.for(2):Error: A specification statement cannot appear in the executable section. real h,v,a,t,f,v0,g,H0 --------^ Error executingdf.exe.


這個錯誤的意思是類型聲明語句不能出現在執行語句部分.
Fortran中類型聲明語句在最前面.你把類型聲明語句放到open那句話前面就行了.



fortran移動數據問題
有n個整數,編程式將前面的各個數依次向後移動k個位置,最後k個數移到最前面的k個位置如:n=8,k=3
移動前:1 2 3 4 5 6 7 8
移動後:6 7 8 1 2 3 4 5


下麵的程式碼我沒運行過,大概就這麼編,有錯誤自己改改吧
program main
integer,parameter::n=8,k=3
integer,dimension(n)::d1,d2
open(1,file=’數據.txt’)
do i=1,n
read(1,*)d1(i)
enddo
close(1)
do i=1,k
d2(i)=d1(n-k+i)
enddo
do i=k+1,n
d2(i)=d1(i-k)
enddo
do i=1,n
write(*,*)d2(i)
enddo
end



電路圖中電源上加一帶箭頭斜杠是什麼意思?


表示該電源是“可調整”(可高可低)的意思.