各位帮我该一道程序题好吗,我真的不知道错在哪里了。
题目如下: 在屏幕上显示器提示信息“Please in put 10 number:" ,提示用户输入10个数(数的范围在0~ 99之间)。然后从键盘上读入这10个数。接着对这10个数从小到达进行排序,并统计0~59,60~79.80~99的个数各有多少。最后在屏幕上显示排序后的数(每个数之间用逗号分隔)并显示统计的结果,显示格式如下:
sorted numbers :XX,XX,XX,XX,XX,XX,XX,XX,XX,XX
程序如下:
DATA SEGMENT
A1 DB 'please input 10 numbers $'
A2 DB 10,?,10 DUP(?)
A3 DB 'Sroted number:$'
S1 DB '0~59:$'
s2 DB '60~79:$'
S3 DB '80~99:$'
B1 DB 0
B2 DB 0
B3 DB 0
COUNT1 DB 2
COUNT2 DB 10
DATA ENDS
STACK SEGMENT PARA 'STACK'
DB 10 DUP(?)
STACK ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA,SS:STACK
START: MOV AX,DATA
MOV DS,AX
MOV AX,STACK
MOV SS,AX
MOV AH,09H
LEA DX,A1
INT 21H
MOV AH,0AH
LEA DX,A2
INT 21H
LEA SI,A2
NEXT2:MOV BX,WORD PTR COUNT1
MOV CX,WORD PTR COUNT2
NEXT1:MOV AL,[SI+2]
CMP AL,A2[BX]
JB NEXT
XCHG AL,A2[BX]
MOV [SI+2],AL
NEXT: INC SI
INC COUNT2
DEC COUNT1
JNZ NEXT2
LEA SI,A2
MOV CX,10
C: MOV AL,[SI+2]
CMP AL,59
JA C1
INC B1
C1:CMP AL,76
JA C2
INC B2
JMP C3
C2:INC B3
C3:INC SI
LOOP C
MOV AH,09H
LEA DX,A3
INT 21H
MOV CX,10
MOV BX,2
D1:MOV AH,02H
MOV DL,A2[BX]
INT 21H
INC BX
LOOP D1
CALL FAN
MOV AH,09H
LEA DX,S2
INT 21H
MOV AH,02H
MOV DL,B2
INT 21H
CALL FAN
MOV AH,09H
LEA DX,S3
INT 21H
MOV AH,02H
MOV DL,B3
INT 21H
FAN PROC NEAR
MOV AH,02H
MOV DL,0AH
INT 21H
MOV DL,0DH
INT 21H
FAN ENDP
CODE ENDS
END START