主题:新手上路,有个error始终解决不了
部分代码:
write(*,*)"请输入数据个数nn=:"
read(*,*)nn
write(*,*)"请输入水的粘度Uw=:"
read(*,*)Uw
write(*,*)"请输入含盐量Csep=:"
read(*,*)Csep
write(*,*)"请输入Sp=:"
read(*,*)Sp
write(*,*)"请输入聚合物的浓度:"
read(*,*) (Cp(i),i=1,nn)
write(*,*)"请输入聚合物的粘度:"
read(*,*) (Up(i),i=1,nn)
sumC1=0;sumC2=0;sumC3=0;sumC4=0
sumU1=0;sumU2=0;sumU3=0
do i=1,nn
sumC1=sumC1+Cp(i)
sumC2=sumC2+Cp(i)**2
sumC3=sumC3+Cp(i)**3
sumC4=sumC4+Cp(i)**4
sumU1=sumU1+(Up(i)/Uw-1)/(Csep**Sp*Cp(i))
sumU2=sumU2+(Up(i)/Uw-1)/(Csep**Sp)
sumU3=sumU3+(Up(i)/Uw-1)/(Csep**Sp)*Cp(i)
end do
real::A(3,3)=(/nn,sumC1,sumC2,sumC1,sumC2,sumC3,sumC2,sumC3,sumC4/)
real::S(3)=(/sumU1,sumU2,sumU3/)
提示错误:
Error: A specification statement cannot appear in the executable section.
大概意思是声明在执行语句之前吧,但是我的A,S数组里的变量都是通过上面的计算得到的,不能放在计算之前啊!这种情况怎么办呢?请高手多多指教!不胜感激!
write(*,*)"请输入数据个数nn=:"
read(*,*)nn
write(*,*)"请输入水的粘度Uw=:"
read(*,*)Uw
write(*,*)"请输入含盐量Csep=:"
read(*,*)Csep
write(*,*)"请输入Sp=:"
read(*,*)Sp
write(*,*)"请输入聚合物的浓度:"
read(*,*) (Cp(i),i=1,nn)
write(*,*)"请输入聚合物的粘度:"
read(*,*) (Up(i),i=1,nn)
sumC1=0;sumC2=0;sumC3=0;sumC4=0
sumU1=0;sumU2=0;sumU3=0
do i=1,nn
sumC1=sumC1+Cp(i)
sumC2=sumC2+Cp(i)**2
sumC3=sumC3+Cp(i)**3
sumC4=sumC4+Cp(i)**4
sumU1=sumU1+(Up(i)/Uw-1)/(Csep**Sp*Cp(i))
sumU2=sumU2+(Up(i)/Uw-1)/(Csep**Sp)
sumU3=sumU3+(Up(i)/Uw-1)/(Csep**Sp)*Cp(i)
end do
real::A(3,3)=(/nn,sumC1,sumC2,sumC1,sumC2,sumC3,sumC2,sumC3,sumC4/)
real::S(3)=(/sumU1,sumU2,sumU3/)
提示错误:
Error: A specification statement cannot appear in the executable section.
大概意思是声明在执行语句之前吧,但是我的A,S数组里的变量都是通过上面的计算得到的,不能放在计算之前啊!这种情况怎么办呢?请高手多多指教!不胜感激!