爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 2125|回复: 0

[求助] fortran中汉字可以写成字符型吗

[复制链接]

新浪微博达人勋

发表于 2014-3-28 15:02:01 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册 新浪微博登陆

x
如题,fortran中如果把字符型的变量赋值成汉字,这样在fortran77里可以吗?为什么最后程序的结果   t(1)---t(5)是0呢?

        characte names(5)*30
      character start*150,title(5)*30
       
      integer t(5)
       
        names(1) ='区站号/马士顿号'
        names(2) ='年'
        names(3) ='月'
        names(4) ='日'
        names(5) ='时次'
         
      open(1,file='20110720220529_SURF_WEA_GLB_MUL_FTM_QC.txt',status='unknown')
         
       
        read(1,100) start(1:150)
       

        do 11 i=1,5
        title(i)=start(30*(i-1)+1:30*i)
        print*,title(i)


       if(trim(adjustl(adjustr(title(i)))).eq.trim(adjustl(adjustr(names(1)))))then
           t(1)=i
          endif
         if(trim(adjustl(adjustr(title(i)))).eq.trim(adjustl(adjustr(names(2)))))then
           t(2)=i
          endif
         if(trim(adjustl(adjustr(title(i)))).eq.trim(adjustl(adjustr(names(3)))))then
           t(3)=i
          endif
         if(trim(adjustl(adjustr(title(i)))).eq.trim(adjustl(adjustr(names(4)))))then
           t(4)=i
          endif
         if(trim(adjustl(adjustr(title(i)))).eq.trim(adjustl(adjustr(names(5)))))then
           t(5)=i
          endif
      print*,t(i)
11    continue

end

密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表