作业帮 > 综合 > 作业

设有10个学生的成绩分别是76,69,84,90,73,88,99,63,100和80分.试编制一个子程序统计60~69

来源:学生作业帮 编辑:大师作文网作业帮 分类:综合作业 时间:2024/11/17 07:12:09
设有10个学生的成绩分别是76,69,84,90,73,88,99,63,100和80分.试编制一个子程序统计60~69分,
70~79分,80~89分,90~99分和100分的人数并分别存放到S6、S7、S8、S9和S10单元中.
用汇编写.
设有10个学生的成绩分别是76,69,84,90,73,88,99,63,100和80分.试编制一个子程序统计60~69
dataseg segment
but db 0DH,0AH,'the result $'
grade dw 76,69,84,90,73,88,99,63,100,80
s6 db 0
s7 db 0
s8 db 0
s9 db 0
s10 db 0
dataseg ends
cseg segment
main proc far
assume cs:cseg,ds:dataseg
start:
push ds
sub ax,ax
push ax
mov ax,dataseg
mov ds,ax
mov cx,10
call count
call disp
mov ah,1
int 21h
ret
main endp
count proc near
mov si,0
next:mov ax,grade[si]
mov bl,10
div bl
mov bl,al
mov bh,0
sub bx,6
cmp bx,0
jae next1
next1:
inc s6[bx]
add si,2
loop next
ret
count endp
disp proc near
lea si,s6
mov cx,5
loop1:
mov dx,OFFSET but
mov ah,9
int 21h
mov dl,[si]
add dl,30h
mov ah,2
int 21h
inc si
loop loop1
ret
disp endp
mov ah,4ch
int 21h
cseg ends
end start