Question: why is my code : . 3 8 6 . model flat, stdcall . stack 4 0 9 6 ExitProcess proto, dwExitCode:dword ReadInt proto WriteInt
why is my code :
model flat, stdcall
stack
ExitProcess proto, dwExitCode:dword
ReadInt proto
WriteInt proto
ReadChar proto
WriteString proto
data
array DWORD DUP
odds DWORD DUP
evens DWORD DUP
minVal DWORD
maxVal DWORD
avgVal DWORD
msgprompt BYTE "Enter a nonnegative integer:
msgmin BYTE "Minimum Array Value:
msgmax BYTE "Maximum Array Value:
msgavg BYTE "Average Array Value:
msgodd BYTE "Odd Array Values:
msgeven BYTE "Even Array Values:
msgrepeat BYTE "Repeat program YN
count DWORD
code
main PROC
startprogram:
mov ecx,
inputloop:
mov edx, OFFSET msgprompt
call WriteString
call ReadInt
cmp eax,
jl fillremaining
mov arrayecx eax
inc ecx
cmp ecx,
jne inputloop
fillremaining:
mov ebx,
fillloop:
cmp ecx,
jge doneinput
mov arrayecx ebx
inc ebx
inc ecx
jmp fillloop
doneinput:
call findminmax
call calculateaverage
call findodds
call findevens
mov edx, OFFSET msgmin
call WriteString
mov eax, minVal
call WriteInt
mov edx, OFFSET msgmax
call WriteString
mov eax, maxVal
call WriteInt
mov edx, OFFSET msgavg
call WriteString
mov eax, avgVal
call WriteInt
mov edx, OFFSET msgodd
call WriteString
mov ecx,
displayodds:
cmp oddsecx
je displayevens
mov eax, oddsecx
call WriteInt
inc ecx
jmp displayodds
displayevens:
mov edx, OFFSET msgeven
call WriteString
mov ecx,
displayevensloop:
cmp evensecx
je repeatprogram
mov eax, evensecx
call WriteInt
inc ecx
jmp displayevensloop
repeatprogram:
mov edx, OFFSET msgrepeat
call WriteString
call ReadChar
cmp alY
je startprogram
exitprogram:
invoke ExitProcess,
ret
main ENDP
findminmax PROC
mov eax, array
mov ebx, eax
mov ecx,
minmaxloop:
cmp ecx,
jge endminmax
mov edx, arrayecx
cmp edx, eax
jl updatemin
cmp edx, ebx
jg updatemax
jmp nextelement
updatemin:
mov eax, edx
jmp nextelement
updatemax:
mov ebx, edx
nextelement:
inc ecx
jmp minmaxloop
endminmax:
mov minVal, eax
mov maxVal, ebx
ret
findminmax ENDP
calculateaverage PROC
mov eax,
mov ecx,
avgloop:
cmp ecx,
jge endavg
add eax, arrayecx
inc ecx
jmp avgloop
endavg:
xor edx, edx
mov ebx,
div ebx
mov avgVal, eax
ret
calculateaverage ENDP
findodds PROC
mov ecx,
mov edx,
oddloop:
cmp ecx,
jge endodd
mov eax, arrayecx
test eax,
jz notodd
mov oddsedx eax
inc edx
notodd:
inc ecx
jmp oddloop
endodd:
ret
findodds ENDP
findevens PROC
mov ecx,
mov edx,
evenloop:
cmp ecx,
jge endeven
mov eax, arrayecx
test eax,
jnz noteven
mov evensedx eax
inc edx
noteven:
inc ecx
jmp evenloop
endeven:
ret
findevens ENDP
WriteInt PROC
ret
WriteInt ENDP
ReadInt PROC
ret
ReadInt ENDP
ReadChar PROC
ret
ReadChar ENDP
WriteString PROC
ret
WriteString ENDP
END main
why does sourcereposTestretryDebugTestretry.exe process exited with code x
To automatically close the console when debugging stops, enable ToolsOptionsDebuggingAutomatically close the console when debugging stops.
Press any key to close this window
happen when trying to run debugger what wrong with the code ive got to turn it in tonight so plz try and give me the fixed verson! nothing shows error on my compiler
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
