teacher struc
surname db 'NO SURNAME '
course db 'NO COURSE '
position db 'prof. '
salary dw 50000
address db 'NO ADDRESS '
teacher ends
data segment
num_elems dw 10
teachers teacher <'Domnin','Programming',,3000,'Gudanova 22'>
teacher <'Belov', 'Math', 'associate professor', 1500, 'Gagarina 1A'>
teacher <'Rysovaniy', 'Programming', 'teacher assistant', 1000,>
teacher <'Gevorkyan', 'Math',, 5000, 'Heroes of Stalingrad 21'>
teacher <'Gogotov', 'ORK', 'teacher assistant', 4000, 'Ivanova 2'>
teacher <'Soshina', 'Math', 'senior teacher', 15000, 'Nutona 15/2'>
teacher <'Sinelnik', 'Physics',,,'Morozova 41/51'>
teacher <'Chernyshov', 'TEMZ',, 22100, 'Bayrona 16'>
teacher <'Chervoniy', 'discrete mathematics',, 11500, 'Kirgizskaya 32'>
teacher <'Matz', 'Math', 'academician', 40500, 'Bluhera 18/1'>
max_salary dw teachers.salary
min_salary dw teachers.salary
middle_salary dw 0
sum dw teachers.salary
Title db 'Teachers:',0Dh,0Ah,0Dh,0Ah,'$'
data ends
stak segment stack
dw 30 dup(?)
tos label word
stak ends
code segment
assume cs:code, ds:data, ss:stak
start:
mov ax, data
mov ds, ax
mov ax, stak
mov ss, ax
mov sp, offset tos
; clean the screen
mov ax, 0700h
mov bh, 0Fh
xor cx, cx
mov dh, 25
mov dl, 80
int 10h
; ------begin working----------
mov bx, size teacher ; keep size of structure in bx
lea di, teachers+bx ; begin count from the 2 element
mov cx, num_elems-1
nextstruct:
mov ax, teachers.salary
add sum, ax
cmp ax, max_salary ; compare max salary and current
jle next1
mov max_salary, ax
next1:
cmp ax, min_salary
jge next2
mov min_salary, ax
next2:
add di, bx
loop nextstruct
mov ax, sum
div num_elems ; value of the middle salary is in ax
mov middle_salary, ax
code ends
end start
Структуры в ассемблере
Код:
Here's the translator's message:
Код:
Assembling file: lb10.asm
**Error** lb10.asm(10) Extra characters on line
Error messages: 1
Warning messages: None
Passes: 1
Remaining memory: 441k
**Error** lb10.asm(10) Extra characters on line
Error messages: 1
Warning messages: None
Passes: 1
Remaining memory: 441k