- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
Fortran练习经典题目
a, 输入一个年、月、日并计算它是本年度的第几天。
b.输入任意一年份,给出该年出生人的属相,如1945年出生的人的属相为“鸡”。
c.显示输出2000~2099年的任何一年的某一月的月历,所要显示的年月有键盘输入。如2002年5月的月历形式如下;
5月 2002年
日 一 二 三 四 五 六
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
d.显示输出2000~2099年的任何一年的年历,并写入一文本文件中。
e.以上功能都应从菜单中选择执行。
提示:a中若y为年份,d是该年的某月某日从1月1日开始经过的天数,则s=(y-1)*1.2425+d。若s除以7后所得的余数取整后为0,则为周日,为1则周一。
program firstquestion
implicit none
integer::q,i,lday
integer::year,month,day,days,mday,ds
character(len=2),dimension(1:37)::tem
! 这个程序可以同时在屏幕和文本中输出计算结果。为了计算不同的问题,引入变量q,当q=1时,计算某年月日是此年的第几天;
! 当q=2时,计算某年的属相;当q=3时,计算月历;当q=4时,计算年历;当q=0时,退出此程序。此外,此程序还设置了对输入
! 年、月、日的判断,判断其是否合法。
print *,when q=1,this program can resolve the question that which day some day is in some year! this is the question one.
print *,when q=2,this program can obtain the shengxiao of some year! this is the question two.
print *,when q=3,this program can obtain the calendar of some month of some year(2000-2099)! this is the question three.
print *,when q=4,this program can obtain the Almanac of some year(2000-2099)! this is the question four.
print *,If you want to exit from this program,please input q=0.
do
print *,input the number of q:
read *,q
if(q==0) exit
if (q==1) then
2000 print *,input the year, the month and the day:
read *,year,month,day
if (month12.or.month0) print *,you input wrong month.
if (month12.or.month0) goto 2000
call leapday(year,month,day,lday)
if (lday==0) print *,you input wrong day.
if (lday==0) goto 2000
call numday(year,month,day,days)
print (a14,i3,a18),The day is the,days, day of this year.
open(25,file=days.dat,status=unknown)
write(25,(a14,i3,a18)) The day is the,days, day of this year.
close(25)
else if (q==2) then
print *,input the year:
read *,year
call shengxiao(year)
else if (q==3) then
2001 print *,input the
文档评论(0)