测试一下论坛 Fortran 语法高亮
program www_fcode_cnuse params
use extrafunc
use interpreter
implicit none
character(len=255) :: s, f,error1,error2
real(fdp) ::r
real(fdp), dimension(:),allocatable :: varvals
integer :: funcnum
write(*,*)"依次输入函数的自变量:"
read(*,'(a)')s
allocate(varvals(f_numbervars(s))) ! f_numbervars(s)为自变量的个数
write(*,*)"输入关于自变量的函数:"
read(*,'(a)')f
write(*,*)"依次输入对应自变量的值:"
read(*,*)varvals
call s_createfn(f, s, funcnum,error1) ! 创建函数
write(*,'(a)')trim(error1) ! 提示出错信息
call s_evaluatefn(funcnum, varvals, r,error2) ! 计算函数值
write(*,'(a)')trim(error2) ! 提示出错信息
write(*,*)"函数值等于:",r
call s_destroyfn(funcnum) ! 销毁函数
stop
end program www_fcode_cn 我来顶顶,灌灌水:$:$:$
页:
[1]