⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 8.asm

📁 统计出各分数段学生的人数,输出各分数段学生的人数
💻 ASM
字号:
data segment
   rank  db  76,69,84,90,73,88,99,63,100,80
   str1  db  "<60:",'$'
   str2  db  "60~69:",'$'
   str3  db  "70~79:",'$'
   str4  db  "80~89:",'$'
   str5  db  "90~99:",'$'
   str6  db  "100:",'$'
   countfail  db  0
   countjige  db  0
   countzhong db  0
   countliang db  0
   countyou   db  0
   countgood  db  0
data ends
code segment
   assume cs:code,ds:data
main proc far
start:
   push ds
   sub ax,ax
   push ax
   mov ax,data
   mov ds,ax
   call  tongji
   call  output
main endp
;子程序名:tongji 
;功能:统计出各分数段学生的人数
tongji  proc near 
   mov cx,10
   mov ax,0
   mov bx,0
   mov dx,0
   mov si,0
aa: 
    mov al,rank[si]
    cmp al,60
    jb  fail
    cmp al,70
    jb  jige
    cmp al,80
    jb zhong
    cmp al,90
    jb  liang
    cmp al,100
    jb you
    inc countgood
fail:
    inc countfail
    jmp bb
jige:
    inc  countjige
    jmp bb
zhong:
    inc  countjige
    jmp bb
liang:
    inc  countliang
    jmp bb
you:
    inc  countyou
    jmp bb
good:
    inc  countgood
    jmp bb
bb:
    inc si
    loop aa
    ret
tongji endp
;子程序名:output
;功能:输出各分数段学生的人数
output  proc near
    lea dx,str1
    mov ah,9
    int 21h
    mov dx,0
    mov dl,countfail
    add dl,30h
    mov ah,2
    int 21h
    call crlf
    mov dx,0

    lea dx,str2
    mov ah,9
    int 21h
    mov dx,0
    mov dl,countjige
    add dl,30h
    mov ah,2
    int 21h
    call crlf
    mov dx,0

    lea dx,str3
    mov ah,9
    int 21h
    mov dx,0
    mov dl,countzhong
    add dl,30h
    mov ah,2
    int 21h
    call crlf
   mov dx,0

    lea dx,str4
    mov ah,9
    int 21h
    mov dx,0
    mov dl,countliang
    add dl,30h
    mov ah,2
    int 21h
    call crlf
    mov dx,0

    lea dx,str5
    mov ah,9
    int 21h
    mov dx,0
    mov dl,countyou
    add dl,30h
    mov ah,2
    int 21h
    call crlf
    mov dx,0

    lea dx,str6
    mov ah,9
    int 21h
    mov dx,0
    mov dl,countgood
    add dl,30h
    mov ah,2
    int 21h
    call crlf
    mov dx,0
    ret
output endp

crlf   proc near
     mov  dl,0dh
     mov  ah,2
     int 21h
     mov  dl,0ah
     mov  ah,2
     int 21h
     ret
crlf endp

     code ends
   end start
















 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -