stud struc
name db ' '
eng db ?
math db ?
comp db ?
phy db ?
sum dw ?
aver db ?
stud ends
code segment
assume cs:code
org 100h
start:jmp bbb
studs stud <'li',90,90,90,90,?,?>
stud <'wang',85,92,75,91,?,?>
stud <'zhao',65,76,80,95,?,?>
stud <'max',0,0,0,0,?,?>
bbb: push cs
pop ds
push cs
pop es
; 以下求总分及平均分
lea si,studs
mov cx,3
@1:
mov dx,0
add dl,[si].eng
adc dh,0
add dl,[si].math
adc dh,0
add dl,[si].comp
adc dh,0
add dl,[si].phy
adc dh,0
mov [si].sum,dx
mov ax,dx
mov bl,4
div bl
mov [si].aver,al
add si,11
loop @1
; 以下求每门课最高分
lea si,studs
mov di,si
mov cx,3
@2:
mov al,[si].eng
cmp al,[di+3*11].eng
jl @3
mov [di+3*11].eng,al
@3:
mov al,[si].math
cmp al,[di+3*11].math
jl @4
mov [di+3*11].math,al
@4:
mov al,[si].comp
cmp al,[di+3*11].comp
jl @5
mov [di+3*11].comp,al
@5:
mov al,[si].phy
cmp al,[di+3*11].phy
jl @6
mov [di+3*11].phy,al
@6:
add si,11
loop @2
; 以下输出平均分
lea si,studs
mov cx,3
@7:
mov al,[si].aver
cbw
call dispaxs
call lfcr
add si,11
loop @7
call lfcr
; 以下输出每门课最高分
lea si,studs
mov cx,4
add si,3*11+4
@8:
mov al,[si]
cbw
call dispaxs
inc si
loop @8
mov ah,4ch
int 21h
; ====================
lfcr proc near
mov ah,2
mov dl,13
int 21h
mov dl,10
int 21h
ret
lfcr endp
;====================================
; 将要显示的有符号数置于 ax 中
DISPAXS PROC NEAR
PUSH AX
PUSH BX
PUSH CX
PUSH DX
PUSH SI
PUSH DI
PUSH BP
PUSH DS
PUSH ES
PUSHF
PUSH CS
POP DS
PUSH CS
POP ES
MOV CX,6
LEA DI,DISPAXSS
@DISPAXS:
MOV BYTE PTR [DI],32
INC DI
LOOP @DISPAXS
PUSH AX
MOV DL,32
MOV AH,2
INT 21H
POP AX
MOV BYTE PTR NZS,0
MOV BYTE PTR SIGNS,0
CMP AX,0
JGE @DISPAXS0
MOV BYTE PTR SIGNS,1
NEG AX
@DISPAXS0:
PUSH AX
LEA SI,DIVARRS
LEA DI,DISPAXSS
INC DI
MOV CX,5
@DISPAXS1:
POP AX
MOV DX,0
MOV BX,[SI]
DIV BX
PUSH DX
CMP AL,0
JNE @DISPAXS2
CMP BYTE PTR NZS,1
JE @DISPAXS2
CMP CX,1
JE @DISPAXS2
MOV DL,20H
JMP @DISPAXS3
@DISPAXS2:
ADD AL,30H
MOV DL,AL
MOV BYTE PTR NZS,1
@DISPAXS3:
MOV BYTE PTR[DI],DL
INC SI
INC SI
INC DI
LOOP @DISPAXS1
POP DX
CMP BYTE PTR SIGNS,1
JNE @DISPAXS6
LEA SI,DISPAXSS
ADD SI,5
@DISPAXS4:
CMP BYTE PTR [SI],32
JE @DISPAXS5
DEC SI
JMP @DISPAXS4
@DISPAXS5:
MOV BYTE PTR [SI],'-'
@DISPAXS6:
LEA DX,DISPAXSS
MOV AH,9
INT 21H
POPF
POP ES
POP DS
POP BP
POP DI
POP SI
POP DX
POP CX
POP BX
POP AX
RET
DIVARRS DW 10000,1000,100,10,1
NZS DB 0
SIGNS DB 0
DISPAXSS DB 32,32,32,32,32,32,'$'
DISPAXS ENDP
; =============================================
code ends
end start
追答请使用tasm编译且应选择多次扫描