Fortran

👱‍♀️Fortran--数据类型:变量声明

2019-03-25  本文已影响0人  YI_YI_
1:变量声明

类型 :: 名称

program variableTesting
    implicit none
    
    !declaring variableas
    integer :: total
    real :: average
    complex :: cx
    logical :: done
    character (len = 80) :: message
    
    !assigning values
    total = 20000
    average = 1666.67
    done = .true.
    message = "Hello Oliva coding Fortran"
    cx = (3.0,5.0) !cx = 3.0+5.0i
    print *,total
    print *,average
    print *,cx
    print *,done
    print *,message
    read*
    
    end program variableTesting

结果:
result_var.png
上一篇下一篇

猜你喜欢

热点阅读