统计分数的程序
设有10个学生的成绩分别是76,69,64,90,73,88,99,63,100和80分。试编制一个子程序统计60~69分,70~79分,80~89分,90~99分和100分的人数并分别存放到S6,S7,S8,S9和S10单元中下面是我做的程序
DATAS segment
A DB 76,69,64,90,73,88,99,63,64H,80
S6 DB 0
S7 DB 0
S8 DB 0
S9 DB 0
S10 DB 0
DATAS ENDS
STACKS SEGMENT
STACKS ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATAS
START:MOV AX,DATAS
MOV DS,AX
MOV CX,0AH
MOV BL,0
MOV SI,OFFSET A
L2: LODSB
CMP AL,100
JNZ L1
INC BL
L1:
DEC CX
JNZ L2
MOV DI,OFFSET S10
MOV AL,BL
STOSB
MOV DL,AL
ADD DL,30H
MOV AH,2
INT 21H
MOV CX,0AH
MOV BL,0
MOV SI,OFFSET A
K2: LODSB
CMP AL,90
JB K1
CMP AL,99
JA K1
INC BL
K1: DEC CX
JNZ K2
MOV DI,OFFSET S9
MOV AL,BL
STOSB
MOV DL,AL
ADD DL,30H
MOV AH,2
INT 21H
MOV CX,0AH
MOV BL,0
MOV SI,OFFSET A
J2: LODSB
CMP AL,80
JB J1
CMP AL,89
JA J1
INC BL
J1: DEC CX
JNZ J2
MOV DI,OFFSET S8
MOV AL,BL
STOSB
MOV DL,AL
ADD DL,30H
MOV AH,2
INT 21H
MOV CX,0AH
MOV BL,0
MOV SI,OFFSET A
H2: LODSB
CMP AL,70
JB H1
CMP AL,79
JA H1
INC BL
H1: DEC CX
JNZ H2
MOV DI,OFFSET S7
MOV AL,BL
STOSB
MOV DL,AL
ADD DL,30H
MOV AH,2
INT 21H
MOV CX,0AH
MOV BL,0
MOV SI,OFFSET A
G2: LODSB
CMP AL,60
JB G1
CMP AL,69
JA G1
INC BL
G1: DEC CX
JNZ G2
MOV DI,OFFSET S6
MOV AL,BL
STOSB
MOV DL,AL
ADD DL,30H
MOV AH,2
INT 21H
MOV AH,4CH
INT 21H
CODE ENDS
END START
前辈们帮看看哪怎么改,谢谢咯~~