输入成绩,显示出学生的学号 成绩及名次DATAS SEGMENT
GRADE DB 50 DUP (?)
RANK DB 50 DUP (?)
STR1 DB 'please input the mark of class:','$'
str2 db 13,10,'$'
str3 db 'Num mark rank','$'
str4 db ' ','$'
str5 db 'input the number of the class(00~99):','$'
NUM dw ?
DATAS ENDS
STACKS SEGMENT
;此处输入堆栈段代码
STACKS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS,SS:STACKS
START:
MOV AX,DATAS
MOV DS,AX
call total
call input
call bijiao
call print
MOV AH,4CH
INT 21H
input proc
mov cx,num
mov si,0
mov dx,offset str1
mov ah,9
int 21h
call huanhang
D1: mov ah,1
int 21h
sub al,30h
cbw
push cx
mov cx,10
mul cx
add bx,ax
mov ah,1
int 21h
sub al,30h
cbw
add bx,ax
mov ax,bx
pop cx
mov bx,offset grade
mov [bx+si],ax
inc si
call huanhang
loop d1
ret
input endp
huanhang proc
mov dx,offset str2
mov ah,9
int 21h
ret
huanhang endp
bijiao proc
mov si,0
sub num,1
d0:
mov dl,1
mov bx,0
mov al,grade[si]
d3:
cmp al,grade[bx]
jl d4
jmp d2
d4:
inc dl
jmp d2
d2:
inc bx
cmp bx,num
jng d3
mov rank[si],dl
inc si
cmp si,num
jng d0
ret
bijiao endp
print proc
mov dx,offset str3
mov ah,9
int 21h
call huanhang
mov si,0
n2:
push si
inc si
mov ax,si
mov dh,10
div dh
mov bl,ah
add al,30h
mov ah,2
mov dl,al
int 21h
add bl,30h
mov ah,2
mov dl,bl
int 21h
call kongge
pop si
push si
mov al,grade[si]
mov dh,10
cbw
div dh
mov bl,ah
add al,30h
mov ah,2
mov dl,al
int 21h
add bl,30h
mov ah,2
mov dl,bl
int 21h
call kongge
pop si
mov al,rank[si]
cbw
mov dh,10
div dh
mov bl,ah
add al,30h
mov ah,2
mov dl,al
int 21h
add bl,30h
mov ah,2
mov dl,bl
int 21h
jmp n0
n0:
2021-10-31 19:26:08
3KB
学生名次
汇编
1