哎 牛人就是任性 晚安 |
好看,唉,打字快就是任性 |
谢谢 弱弱地问一句 你为什么喜欢用空格 我感觉这样很费劲啊 比如amean= sum(a) / N 为什么不写成amean=sum(a)/N |
[Fortran] 纯文本查看 复制代码 program main implicit none integer::i,c(3,4),a_1(3,2),a(6),b_1(3,2),b(6) real amean,bmean,sfenzi,sfenmu_1,sfenmu_2,coefficient open(12,file=1.txt') read(12,*)c a_1=c(:,1:2) b_1=c(:,3:4) a=reshape(a_1,(/6/)) b=reshape(b_1,(/6/)) amean=real(sum(a))/real(size(a)) bmean=real(sum(b))/real(size(b)) write(*,*)"a=",a write(*,*)"b=",b write(*,*)"amean=",amean write(*,*)"bmean=",bmean sfenzi=0.0 sfenmu_1=0.0 sfenmu_2=0.0 do i=1,size(a) sfenzi=sfenzi+(real(a(i))-amean)*(real(b(i))-bmean) sfenmu_1=sfenmu_1+(real(a(i))-amean)**2 sfenmu_2=sfenmu_2+(real(b(i))-bmean)**2 end do coefficient=sfenzi/sqrt(sfenmu_1*sfenmu_2) write(*,*)"coefficient=",coefficient stop end program |
捐赠本站|Archiver|关于我们 About Us|小黑屋|Fcode ( 京ICP备18005632-2号 )
GMT+8, 2024-12-23 12:13