求助!用分支结构编程
要求:编写一个闰年的汇编程序语言,判断某个年份是否是闰年,如果是,输出“YES!”如果不是则输出“NO!”
年份变量名称为year,他是一个字变量。
将year依次赋值为1995,1664,1900,2000,检查程序的输出结果是否正确。
[[italic] 本帖最后由 永夜的极光 于 2007-12-9 20:07 编辑 [/italic]]
版主 你看一下我这个错在哪里 我对那位老兄的题感兴趣 但又不好做 你帮忙看一吧
datar segmentde dw ?
year dw ?
dito dw 4
dw 100
dw 400
string db 'Please input the year:','$'
string2 db 'The year is a oK!','$'
string3 db 'the year is not ok!','$'
datar ends
code segment
assume cs:code,ds:datar
main proc;....................10
push ds
xor ax,ax
push ax
start:
lea dx,string
mov ah,09h
int 21h
mov dx,0
mov ah,01h
int 21h
mov de, ax;..............20
mov bx,dx
div dito
cmp dx,0
jz print
mov ax,de
mov dx,bx
div dito+2
jne print
mov ax,de
mov dx,bx;...............30
div dito+4
jz print
jmp print1
print: lea dx,string2
mov ah,09h
int 21h
jmp start
print1: lea dx,string3
mov ah,09h
int 21h
jmp start
ret
main endp
code ends
end start mov ah,01h
int 21h
这个只能获取一个字符的输入,这个题目要输入的话,肯定是字符串的,要用0AH子功能
页:
[1]
