?? 閏年可行.txt
字號:
datas segment
year db 50,?,50 dup(?)
input db 0dh,0ah,'Please input one year:$'
yes db 0dh,0ah,'The year is a leap year!$'
no db 0dh,0ah,'The year is not a leap year!$'
error db 0dh,0ah,'The year is illegal! $'
crlf db 0ah,0dh,'$'
datas ends
code segment
main proc far
assume cs:code,ds:datas
start:
push ds
sub ax,ax
push ax
mov ax,datas
mov ds,ax
lea dx,input
mov ah,9
int 21h
lea dx,year
mov ah,10
int 21h
lea dx,crlf
mov ah,9
int 21h
cmp year[1],4
jnz output3
lea si,year+2
mov dh,year[si]
mov dl,year[si+1]
cmp dh,31h
jz cmp1
cmp dh,32h
jz cmp2
jmp output3
cmp1:
cmp dl,39h
jz compare
jmp output3
cmp2:
cmp dl,30h
jz compare
cmp dl,31h
jz compare
jmp output3
compare:
mov ah,year[si+2]
cmp ah,39h
jg output3
cmp ah,30h
jl output3
mov al,year[si+3]
cmp al,39h
jg output3
cmp al,30h
jl output3
cmp dh,31h
jz chuli1
cmp dl,30h
jz chuli2
cmp ah,30h
jnz output3
cmp al,30h
jnz output3
jmp output2
chuli1:
cmp al,30h
jnz chuli2
cmp ah,30h
jnz chuli2
jmp output2
chuli2:
shr al,1
jc output2
mov bl,al
shr ah,1
jc chuli3
jmp chuli4
chuli3:
shr al,1
jnc output2
jmp output1
chuli4:
shr bl,1
jc output2
output1:
lea dx,yes
mov ah,09h
int 21h
jmp exit
output2:
lea dx,no
mov ah,09h
int 21h
jmp exit
output3:
lea dx,error
mov ah,09h
int 21h
exit:
ret
main endp
code ends
end start
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -