program main
character(len=20) string
character(len=20) substring
integer position
string = "have a good time."
substring = "good"
write(*,*) index(string,substring)
position = index(string, substring)
if (position == 0) then
write(*,*) "Substring not found in string."
else
write(*,*) "Substring found at position:", position
endif
end
Fortran语言,在ubuntu16和24里面都用gfortran试过了,输出都是0和Substring not found in string。
请问这是为什么啊