fortran 数据类型
1 Program wf 2 Implicit None 3 Integer ,parameter ::KI=Selected_Int_Kind(9) 4 Real (Kind=KI)::m=0.0 5 Integer(Kind=KI)::i=0,j,k 6 write(*,*) Kind(i),i 7 write(*,*) Kind(m),m 8 9 write(*,*) huge(i) 10 write(*,*) huge(m) 11 i=i+100_KI 12 m=m+100_KI 13 write(*,*) i 14 write(*,*) m 15 end
Selected_real_kind(n,e) : 返回如果想要能够记录具有N位有效位数、指数达到e位的浮点数所需要的kind值。返回-1表示无法满足所要求的有效位数、返回-2表示无法满足所要求的指数范围、返回-3表示两者都无法满足
1 program ex1 2 implicit none 3 type :: Person 4 !integer DP=Selected_Integer_Kind(14) 5 integer(kind=8) :: PersonId 6 character(len=12)::Name 7 character(len=100)::Add 8 end type 9 type(Person):: ZhuBinglong 10 ZhuBinglong%PersonId=110901199510096895 11 ZhuBinglong%Name="ZhuBinglong" 12 ZhuBinglong%Add="HaiDian District Beijing" 13 write(*,*) "please print the person's information:" 14 write(*,*) 'the person PersonId:',ZhuBinglong%PersonId 15 write(*,*) "the person name:",ZhuBinglong%Name 16 write(*,*) "the person's address:",ZhuBinglong%Add 17 print *,"program terminated" 18 stop 19 end program ex1