键盘输入10个学生的成绩,编程序统计60~69分,70~79分,80~89分,90~99分,和100分的人数,并在电脑上显示

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

;键盘输入10个学生的成绩,统计602~69分,70~79分,80~89分,90~99分及100分的人数
DSEG SEGMENT
MESS0 DB 128
DB 0
DB 128 DUP(0)
S6 DB 0
S7 DB 0
S8 DB 0
S9 DB 0
S10 DB 0

MESS1 DB '60~69=$'
MESS2 DB '70~79=$'
MESS3 DB '80~89=$'
MESS4 DB '90~99=$'
MESS5 DB '100=$'
MESS6 DB 'Please input the student`s score(end by !) :$'
MESS7 DB 'The statistical results as follows:$'
DSEG ENDS

CSEG SEGMENT
ASSUME CS:CSEG,DS:DSEG
START1:
MOV AX,DSEG
MOV DS,AX
MOV DX,OFFSET MESS6
CALL DISPMESS
CALL NEWLINE
START:
MOV DX,OFFSET MESS0
MOV AH,0AH
INT 21H
LEA SI,MESS0+2
CMP [SI],'!'
CALL NEWLINE
JZ OVER

CMP [SI], '0'
JZ START
CMP [SI],'2'
JZ START
CMP [SI],'3'
JZ START
CMP [SI],'4'
JZ START
CMP [SI],'5'
JZ START

CMP [SI],'6'
JZ C
CMP [SI],'7'
JZ D
CMP [SI],'8'
JZ E
CMP [SI],'9'
JZ F
CMP [SI],'1'
JZ A
JMP START
L1:ADD [S6],1
JMP START

L2:ADD [S7],1
JMP START

L3:ADD [S8],1
JMP START

L4:ADD [S9],1
JMP START

L5:ADD [S10],1
JMP START

A:INC SI
CMP [SI],'0'
JZ A1
JMP START
A1:INC SI
CMP [SI],'0'
JZ A2
JMP START
A2: INC SI
CMP [SI],'0'
JAE START
JMP L5
C:INC SI
CMP [SI],'0'
JB START
CMP [SI],'9'
JBE C1
JMP START
C1:INC SI
CMP [SI],'0'
JAE START
JMP L1

D:INC SI
CMP [SI],'0'
JB START
CMP [SI],'9'
JBE D1
JMP START
D1:INC SI
CMP [SI],'0'
JAE START
JMP L2
E:INC SI
CMP [SI],'0'
JB START
CMP [SI],'9'
E1:INC SI
CMP [SI],'0'
JAE START
JMP L3

F:INC SI
CMP [SI],'0'
JB START
CMP [SI],'9'
JBE F1
JMP START
F1:INC SI
CMP [SI],'0'
JAE START
JMP L4

;-------------------------------------------------------------
;子程序名:NEWLINE
;形成回车和换行
;入口参数:无
;出口参数:无
;通过显示回车符形成回车,通过显示换行符形成换行
;-----------------------------------------------------------

NEWLINE PROC NEAR
PUSH AX
PUSH DX
MOV DL,0DH
MOV AH,2
INT 21H
MOV DL,0AH
MOV AH,2
INT 21H
POP DX
POP AX
RET
NEWLINE ENDP

OVER:MOV DX,OFFSET MESS7
CALL DISPMESS
CALL NEWLINE
MOV DX,OFFSET MESS1
CALL DISPMESS
ADD [S6],30H
MOV DL,[S6]
MOV AH,2
INT 21H
CALL NEWLINE

MOV DX,OFFSET MESS2
CALL DISPMESS
ADD [S7],30H
MOV DL,[S7]
MOV AH,2
INT 21H

CALL NEWLINE

MOV DX,OFFSET MESS3
CALL DISPMESS
ADD [S8],30H
MOV DL,[S8]
MOV AH,2
INT 21H

CALL NEWLINE
MOV DX,OFFSET MESS4
CALL DISPMESS
ADD [S9],30H
MOV DL,[S9]
MOV AH,2
INT 21H

CALL NEWLINE
MOV DX,OFFSET MESS5
CALL DISPMESS
ADD [S10],30H
MOV DL,[S10]
MOV AH,2
INT 21H
CALL NEWLINE
JMP NEXT

DISPMESS PROC NEAR
MOV AH,9
INT 21H
RET
DISPMESS ENDP
NEXT:
MOV AH,4CH
INT 21H
CSEG ENDS
END START1

相关文档
最新文档