选择结构练习
1、从键盘输入一字符,判断该字符是小写字母、大写字母、数字还是其它字符。若输入为小写字母,则显示“You Input a Lowercase Letter!”;若输入为大写字母,则显示“You Input a Uppercase Letter!”;若输入为数字,则显示“You Input a Digit!”;若输入为其它字符,则显示“You Input Other Letter!”。
-
DATAS SEGMENT
-
INFOR DB 'Are you really want to exit?$'
-
INFOR_Y DB 0AH,0DH,'Thank you for your using!$'
-
INFOR_N DB 0AH,0DH,'Lets continue!$'
-
INFOR_O DB 0AH,0DH,'You press an error key!$'
-
DATAS ENDS
-
-
CODES SEGMENT
-
ASSUME CS:CODES,DS:DATAS
-
START:
-
MOV AX,DATAS
-
MOV DS,AX
-
-
MOV DX,OFFSET INFOR
-
MOV AH,09H
-
INT 21H
-
-
MOV AH,01H
-
INT 21H
-
-
AND AL,11011111B
-
-
CMP AL,01011001B
-
JE INPUT_Y
-
-
CMP AL,01001110B
-
JE INPUT_N
-
-
JMP INPUT_O
-
-
INPUT_Y:
-
MOV DX,OFFSET INFOR_Y
-
JMP RESULT
-
-
INPUT_N:
-
MOV DX,OFFSET INFOR_N
-
JMP RESULT
-
-
INPUT_O:
-
MOV DX,OFFSET INFOR_O
-
-
RESULT:
-
MOV AH,09H
-
INT 21H
-
-
MOV AH,4CH
-
INT 21H
-
CODES ENDS
-
END START