汇编语言 循环判断 输入是否为数字
源码:
data segment string1 db 'Please input a number:',0dh,0ah,'$' string2 db 0dh,0ah,'It is a number!',0dh,0ah,'$' string3 db 0dh,0ah,'It is not a number!',0dh,0ah,'$'data endscode segment assume cs:code,ds:datastart: mov ax,data mov ds,axTIP: lea dx,string1 mov ah,09h int 21h mov ah,01h int 21h cmp al,30h jnc GOON lea dx,string3 mov ah,09h int 21h jmp TIPGOON: cmp al,3ah jnc DONE lea dx,string2 mov ah,09h int 21h jmp EXITDONE: lea dx,string3 mov ah,09h int 21h jmp TIPEXIT: mov ah,4ch int 21hcode ends end start
运行截图: