[問題] 想請問一個cycle的問題
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
→
09/17 15:26, , 1F
09/17 15:26, 1F
→
09/17 15:42, , 2F
09/17 15:42, 2F
→
09/17 15:44, , 3F
09/17 15:44, 3F
→
09/18 16:25, , 4F
09/18 16:25, 4F
→
09/19 02:25, , 5F
09/19 02:25, 5F
→
09/20 01:26, , 6F
09/20 01:26, 6F
Fortran 近期熱門文章
PTT數位生活區 即時熱門文章