看板 Fortran 關於我們 聯絡資訊
program ex0502 implicit none real(kind=4)::ma,age,IQ integer::counter integer parameter::limit=5 do counter=1,limit if(age<=0)cycle write(*,*)"請輸入心理年齡" read(*,*)ma write(*,*)"請輸入實際年齡" read(*,*)age IQ=(ma/age)*100 end do if(IQ>140)then write(*,*)"您是天才" else if(IQ<140.and.IQ>120)then write(*,*)"您的智力非常優秀" else if(IQ<120.and.IQ>110)then write(*,*)"您的智力優秀" else if(IQ<110.and.IQ>90)then write(*,*)"您的智力普通" else if(IQ<90.and.IQ>80)then write(*,*)"您的智力偏低" else if(IQ<80.and.IQ>70)then write(*,*)"您的智力有缺陷" else if(IQ<70.and.IQ>0)then write(*,*)"您的智力屬於低能程度" else write(*,*)"給你爸裝笑偉" end if stop end 這樣寫有兩個錯誤, 1.C:\Program Files\Microsoft Visual Studio\MyProjects\0202\2020.f90(5) : Error: Syntax error, found IDENTIFIER 'PARAMETER' when expecting one of : ( : % . = => integer parameter::limit=5 ------------------------------^ 2.C:\Program Files\Microsoft Visual Studio\MyProjects\0202\2020.f90(7) : Error: This name does not have a type, and must have an explicit type.[LIMIT] do counter=1,limit -------------------^ 小弟試著找出,但不知道是甚麼意思錯誤,請高手解惑,感激不盡。 -- -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.116.200.92
gazzy:integer, parameter::limit=5 09/17 15:26
libra1005:謝謝您的解答,但我改正之後還有一個錯誤 09/17 15:42
libra1005:OK了 謝謝你 09/17 15:44
UDP:按照1F修改後,測試沒錯誤ㄚ..... 09/18 16:25
gaiger:請問原po用誰的complier ? 怎可以吃中文? 09/19 02:25
UDP:那不是吃中文,吃的是ASCII 09/20 01:26