fortran中如何使两个if语句同时运行
if((z>=7.96 .and. z<=8.23) .or. (z>=9.31 .and. z<=9.58)) then
if((z>=11.47 .and. z<=11.74).or. (z>=13 .and. z<=13.27)) then
if((z>=7.96 .and. z<=8.23) .or. (z>=9.31 .and. z<=9.58) .or.(z>=11.47 .and. z<=11.74).or. (z>=13 .and. z<=13.27) ) then 这种方式不够优雅,而且想增加新的区间会比较累。像我这样写,优雅
real :: a(2,4)
a = reshape(,shape(a))
if( any( z>=a(1,:).and.z<=a(2,:) ) ) then
页:
[1]