首页 > 其他 > 详细

判断某一年是否为闰年

时间:2014-04-27 02:39:42      阅读:480      评论:0      收藏:0      [点我收藏+]
; 判断某一年是否为闰年,是则eax=1,否eax=0
; 
; author:  wangguolaing
; date:  revised 4/14

.386
.MODEL FLAT

INCLUDE io.h
includelib Kernel32.lib
ExitProcess PROTO NEAR32 stdcall, dwExitCode:DWORD

cr          EQU    0dh  
Lf          EQU    0ah    

.STACK      4096

.DATA
prompt      BYTE   cr,Lf,‘Plase enter a year :‘,cr,Lf,Lf,0
number      BYTE  16 DUP(?)
year        DWORD  ?
Leapyear    BYTE ‘The year is a leap year‘,cr,Lf,Lf,0
Commonyear  BYTE ‘The year is a common year‘,cr,Lf,Lf,0


.CODE
_start:
  output prompt
  input  number,16
  atod number
  mov year,eax

  cdq
  mov ecx,4
  idiv ecx
  cmp edx,0
  jg  common
  mov eax,year
  cdq
  mov ecx,100
  idiv ecx
  cmp edx,0
  je common 

leap  :
       output Leapyear
       jmp quit

common :
       output Commonyear

quit:       INVOKE ExitProcess, 0   ; exit with return code 0

PUBLIC _start                       ; make entry point public
            END                     ; end of source code

判断某一年是否为闰年,布布扣,bubuko.com

判断某一年是否为闰年

原文:http://blog.csdn.net/zzucsliang/article/details/24547391

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!