Fnewhand 发表于 2014-3-15 21:46:08

程序执行结果有误

program ex65
    integer::j =1
    integer:: i,max
    character (len=20)::string
    character (len=20)::substring
    write (*,*)"String:"
    read (*,*)string
    max=len_trim(string)
    do i =1,max
      if (ichar(string (i:i))==255) cycle
            substring(j:j)=string(i:i)
            j=j+1
    end do
    write (*,"(a20)")substring
    stop
    end 这段程序是用来去掉一段字符中的所有空格的,但是,当它遇到第一个空格时就会结束运行,后面的字符就不显示了,怎么回事?请指点。

fcode 发表于 2014-3-15 21:50:42

我的祖宗,我昨天才告诉过你。

Fnewhand 发表于 2014-3-15 21:51:51

:-funk:不是吧

Fnewhand 发表于 2014-3-15 21:52:28

:-L这read。。。

Fnewhand 发表于 2014-3-15 21:53:06

好吧,没长记性
页: [1]
查看完整版本: 程序执行结果有误