fortran90总结第二章(部分) 林晓彤主编.docVIP

fortran90总结第二章(部分) 林晓彤主编.doc

  1. 1、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
  4. 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
  5. 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们
  6. 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
  7. 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
fortran90总结第二章(部分) 林晓彤主编

第一章: 类型说明(种别说明),属性说明1,属性说明2…… Integer(kind=2),dimension(1:14),……. 2.1程序 program height_of_yao implicit none integer::height ,height_feet !声明整形变量 real::h_inch,height_inches !声明实型变量 integer,parameter::foot_inch=12 !整型符号常量 real,parameter::inch_cm=2.54 !实型符号常量 height=226 !身高厘 米数 h_inch=height/inch_cm !折合英尺 print*,The height is,h_inch,inches. height_feet=int(h_inch/foot_inch) !身高英尺数 height_inches=h_inch-height_feet*foot_inch !身高英寸数 print*,The height is,height_feet,feet, height_inches,inches. end program height_of_yao !在不同处理器中,表示同样精度和范围的树枝,所采取的种别参数是不一样的。 2.2.1整形数据 program test implicit none integer::forty_two,sixty_three,max_byte forty_two=B101010 !二进制赋值 sixty_three=O77 !十进制赋值 max_byte=Zff !十六进制赋值 print*,forty_two=,forty_two,sixty_three=,sixty_three,max_byte=,ma x_byte end program test kind的妙用:kind的数值依赖于处理器。 program select_kind implicit none integer,parameter::i=selected_int_kind(6) print*,6_i !程序输出‘6’ print*,kind(2_i),i !程序输出‘4,4’ print*,kind(0),kind(0.0) !输出的都是默认的种别,是一个整数。其括号里不同是因为不同类型数的种别,kind永远是实行的。 end program select_kind program real_kind implicit none real::j integer,parameter::i=selected_real_kind(3,4) !提供三位精度以及 10000位的范围,!!!!!!kind类型必须是一个正型变量。 print*,i print*,6.0_i end program program test implicit none print*,1_iam,.true._2 !注意字符型的变量的kind写法。true的暑促结果只是T pintt*,kind(A) !缺省的字符型种别参数。 end program test program test implicit none character(len=5)::strl=abcdefg print*,strl print*,1_iam hehe end program test 2.2.6type的妙用: program test implicit none type person !type的定义是在变量说明之前进行的。 character(len=8)::name logical::marry real::salary end type person type(person)::boy boy=person(lxp,.false.,300000.50) print*,boy print*,boy%name !注意引用子部分的方法。 end program test 数据在机器内的存储方式不同:整形数据存储处理快,而实型的存储处理慢,但是整形无误差,故尽量用实型。 每一个复型变量输入一对括号,括号内先写实数部,再写虚数部。 program test implicit none real::a,b read(i2),a,b read(*,(i2))a,b read*,a,b !正在输入中/表示停止输入,而编辑福可以重复利用。 end program test program test implicit

文档评论(0)

cgtk187 + 关注
实名认证
文档贡献者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档