fortran编程错误? 255
PROGRAMweekday_weekendIMPLICITNONECHARACTER(len=11)::c_dayCHARACTER(len=11)::c_typeWR...
PROGRAM weekday_weekend
IMPLICIT NONE
CHARACTER(len=11)::c_day
CHARACTER(len=11)::c_type
WRITE(*,*)'Enter the name of the day:'
READ(*,*)c_day
SELECT CASE(c_day)
CASE('Monday','Tuesday','Wednesday','Thursday','Friday')
c_type='Weekday'
CASE('Saturday','Sunday')
c_type='Weekend'
CASE DEFAULT
c_type='Invalid day'
END SELECT
WRITE(*,*)'Day Type=',c_type
END PROGRAM weekday_weekend
编译错误:
:\MSDEV\Projects\a\Text3.f90
C:\MSDEV\Projects\a\Text3.f90(4): error FOR2290: implicit type for LEN detected between LEN and -
C :\MSDEV\Projects\a\Text3.f90(16): warning FOR4265: symbol LEN referenced but not set
Error executing fl32.exe.
a.exe - 1 error(s), 1 warning(s)
错在哪? 展开
IMPLICIT NONE
CHARACTER(len=11)::c_day
CHARACTER(len=11)::c_type
WRITE(*,*)'Enter the name of the day:'
READ(*,*)c_day
SELECT CASE(c_day)
CASE('Monday','Tuesday','Wednesday','Thursday','Friday')
c_type='Weekday'
CASE('Saturday','Sunday')
c_type='Weekend'
CASE DEFAULT
c_type='Invalid day'
END SELECT
WRITE(*,*)'Day Type=',c_type
END PROGRAM weekday_weekend
编译错误:
:\MSDEV\Projects\a\Text3.f90
C:\MSDEV\Projects\a\Text3.f90(4): error FOR2290: implicit type for LEN detected between LEN and -
C :\MSDEV\Projects\a\Text3.f90(16): warning FOR4265: symbol LEN referenced but not set
Error executing fl32.exe.
a.exe - 1 error(s), 1 warning(s)
错在哪? 展开
1个回答
展开全部
你的fortran程序有两处问题,
1len=11写成了len-11
2weekday写成了weekend
完整的程序如下(改动的地方见注释)
PROGRAM weekday_weekend
IMPLICIT NONE
CHARACTER(len=11)::c_day
CHARACTER(len=11)::c_type !这里把(len-11)改成(len=11)
WRITE(*,*)'Enter the name of the day:'
READ(*,*)c_day
SELECT CASE(c_day)
CASE('Monday','Tuesday','Wednesday','Thursday','Friday')
c_type='Weekday' !这里把Weekend改成Weekday
CASE('Saturday','Sunday')
c_type='Weekend'
CASE DEFAULT
c_type='Invalid day'
END SELECT
WRITE(*,*)'Day Type=',c_type
END PROGRAM weekday_weekend
追问
改了没用
追答
我这里没错啊,我用的fortran95编译没问题,如果你把两个CHARACTER(len=11)改成CHARACTER(11),看看还有错吗?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询