Use assembly language to write a program that counts the number of passing, failing, and absentee exams for the following grades

PHPz
Release: 2024-01-22 22:12:05
forward
575 people have browsed it

Write a program in assembly language: count the number of people who passed, failed and missed the exam respectively

debug Execute and view the running results. 06 is the number of passing exams, 02 is the number of failing exams, and 01 is the number of absent exams.

Use assembly language to write a program that counts the number of passing, failing, and absentee exams for the following grades

dseg segment

scores db 87,94,76,52,71,83,-1,66,41

cnt equ $-scores ;number of scores

p db 0 ;>=60

q db 0 ;

r db 0 ;-1

dseg ends

cseg segment

assume cs:cseg, ds:dseg

start:

mov ax, dseg

mov ds, ax

lea si, scores

mov cx, cnt

s0:

mov al, [si]

cmp al, -1

je s3

cmp al, 60

jb s2

inc p ; Number of >=60

jmp s4

s2:

inc q ;

jmp s4

s3:

inc r ; number of -1

s4:

incsi

loop s0

; print p, q, r, output the results, because the question does not ask for it, so skip it

mov ah, 4ch

int 21h

cseg ends

end start

There are 100 students whose score statistics are 100 90 60 9060. How many students below are written in assembly

Assume that student scores are stored in the data segment starting at 1000h, and the segment address is 2000h

code segment assume cs:code start: mov bx,00h mov dx,00h mov di,00h

mov ax,2000h

mov cx,100

mov ds,ax

mov si,1000h mov ax,01h next6:mov [si],ax inc ax inc si loop next6 mov cx,100 mov si,1000h

next4:cmp byte ptr[si],90

jg next

cmp byte ptr[si],60

jg next2

inc di

incsi

loop next4

jmp next5

next:inc bx

incsi

loop next4

next5:int 3h

next2:inc dx

incsi

loop next4

jmp next5

code ends

end start

Write a student performance statistics program using VB

Private Sub Form_Click()

Dim Score As Single, Sum As Single, N As Integer, Average As Single

Sum = 0

N = 0

Score = InputBox ("Please enter a student's score", "Score input")

Do While Score -1

Sum = Sum Score

N = N 1

Score = InputBox ("Please enter the score of the student" & N 1 & "score", "score input")

Loop

Average = Sum / N

Print "The average score is:"; Average

End Sub

The above is the detailed content of Use assembly language to write a program that counts the number of passing, failing, and absentee exams for the following grades. For more information, please follow other related articles on the PHP Chinese website!

source:docexcel.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!