人机对话的一个题目,怎么做
代码如下DATAS SEGMENT
MSG1 DB"What is your name? $" ;此处输入数据段代码
MSG2 DB"How old are you? $"
MSG DB 10,13,'$'
BUF DB 20
DB ?
DB 20 DUP(?)
BUF2 DB 10
DB ?,10 DUP(?)
DATAS ENDS
STACKS SEGMENT
;此处输入堆栈段代码
STACKS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS,SS:STACKS
START:
MOV AX,DATAS
MOV DS,AX
LEA DX,MSG1
MOV AH,9
INT 21H
LEA DX,MSG
MOV AH,9
INT 21H
LEA DX,BUF
MOV AH,10
INT 21H
LEA DX,MSG
MOV AH,9
INT 21H
LEA DX,MSG2
MOV AH,9
INT 21H
LEA DX,MSG
MOV AH,9
INT 21H
LEA DX,BUF2
MOV AH,10
LEA DX,MSG
MOV AH,9
INT 21H ;此处输入代码段代码
LEA DX,BUF2
MOV AH,10
INT 21H
MOV AH,4CH
INT 21H
CODES ENDS
END START
程序执行结果如下:
what is you name?
xing xing
how old are you ?
20
现在我想实现在输入完20岁的年龄之后回车显示一个语句如:
what is you name?
xing xing
how old are you ?
20
Oh,you are xing xing,and you are 20