.386
.model flat, stdcall
option casemap : none
includelib msvcrt.lib
printf PROTO C :dword, :vararg
scanf PROTO C :dword, :vararg
.data
outputStart byte 'input ten num', 0ah, 0
outputCount byte 'input the %d num', 0ah, 0
input byte '%d', 0
outputResult byte 'the max num is %d', 0ah, 0
iArray dword 5 dup (?)
.code
start proc
mov ebx, offset iArray
mov ecx, 5
xor esi, esi
startInput:
invoke printf, offset outputCount, esi
invoke scanf, offset input, ebx
add ebx, 4
inc esi
cmp esi, 5
jnz startInput
mov esi, 1
mov eax, dword ptr iArray
mov ebx, offset iArray
getMax:
cmp eax, dword ptr [ebx + esi * 4]
jl updateMax
inc esi
cmp esi, 5
jz output
jmp getMax
updateMax:
mov eax, dword ptr [ebx + esi * 4]
inc esi
cmp esi, 5
jnz getMax
output:
invoke printf, offset outputResult, eax
ret
start endp
end start