- 积分
- 4699
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2013-3-13
- 最后登录
- 1970-1-1
|
发表于 2013-5-14 13:34:52
|
显示全部楼层
本帖最后由 夏朗的芒果 于 2013-5-14 13:38 编辑
问题1:
需要给数组赋初值,即
integer::dongqing(37,17)=0,dongmid(37,17)=0,dongzhong(37,17)=0,dongte(37,17)=0
integer::chunqing(37,17)=0,chunmid(37,17)=0,chunzhong(37,17)=0,chunte(37,17)=0
integer::xiaqing(37,17)=0,xiamid(37,17)=0,xiazhong(37,17)=0,xiate(37,17)=0
integer::qiuqing(37,17)=0,qiumid(37,17)=0,qiuzhong(37,17)=0,qiute(37,17)=0
不然在循环中容易出问题 接下来的读取数据是没有问题的
问题2: 在读取数据后的操作中,程序本身没有问题,只不过程序还可以优化。k与m是重复的,这样造成程序多运算了37遍,效率不高,对CPU损耗太大。另外在冬季判别中最后一项k-1有逻辑错误,会小于1974. 具体怎么优化,LZ自己想想吧
问题3:
在写入文本时,循环出错,do i=1974,2010,这样子造成数组dongqing(i,j)等第一个就是从dongqing(1974,j)开始,大于dongqing(37,j),形成数组溢出,可改成do i=1,37,即
open(30,file='E:\aaa\dongqing.txt')
open(40,file='E:\aaa\dongmid.txt')
open(50,file='E:\aaa\dongzhong.txt')
open(60,file='E:\aaa\dongte.txt')
open(70,file='E:\aaa\chunqing.txt')
open(80,file='E:\aaa\chunmid.txt')
open(90,file='E:\aaa\chunzhong.txt')
open(100,file='E:\aaa\chunte.txt')
open(110,file='E:\aaa\xiaqing.txt')
open(120,file='E:\aaa\xiamid.txt')
open(130,file='E:\aaa\xiazhong.txt')
open(140,file='E:\aaa\xiate.txt')
open(150,file='E:\aaa\qiuqing.txt')
open(160,file='E:\aaa\qiumid.txt')
open(170,file='E:\aaa\qiuzhong.txt')
open(180,file='E:\aaa\qiute.txt')
do i=1,37
write(30,'(i6,17i6)') i+1973,(dongqing(i,j),j=1,17)
write(40,'(i6,17i6)') i+1973,(dongmid(i,j),j=1,17)
write(50,'(i6,17i6)') i+1973,(dongzhong(i,j),j=1,17)
write(60,'(i6,17i6)') i+1973,(dongte(i,j),j=1,17)
write(70,'(i6,17i6)') i+1973,(chunqing(i,j),j=1,17)
write(80,'(i6,17i6)') i+1973,(chunmid(i,j),j=1,17)
write(90,'(i6,17i6)') i+1973,(chunzhong(i,j),j=1,17)
write(100,'(i6,17i6)') i+1973,(chunte(i,j),j=1,17)
write(110,'(i6,17i6)') i+1973,(xiaqing(i,j),j=1,17)
write(120,'(i6,17i6)') i+1973,(xiamid(i,j),j=1,17)
write(130,'(i6,17i6)') i+1973,(xiazhong(i,j),j=1,17)
write(140,'(i6,17i6)') i+1973,(xiate(i,j),j=1,17)
write(150,'(i6,17i6)') i+1973,(qiuqing(i,j),j=1,17)
write(160,'(i6,17i6)') i+1973,(qiumid(i,j),j=1,17)
write(170,'(i6,17i6)') i+1973,(qiuzhong(i,j),j=1,17)
write(180,'(i6,17i6)') i+1973,(qiute(i,j),j=1,17)
enddo
通篇看完LZ的程序,其实真的伤到了,希望楼主有空多练练FORTRAN和算法,这样能提升自身解决问题的能力。
|
|