Question: Using MASM irvine 3 2 . inc Corrrect my program it runs incorrectly. Your program will require to get 5 integers from the user. Store

Using MASM irvine32.inc
Corrrect my program it runs incorrectly. Your program will require to get 5 integers from the user. Store these
numbers in an array. You should then display stars depending on those
numbers. If it is between 50 and 59, you should display 5 stars, so you are
displaying a star for every 10 points in grade. Your program will have a
function to get the numbers from the user and another function to display the
stars.
Example:
5930834211//the Grades the user input
*****
***
********
****
*
I will check the code to make sure you used arrays and loops correctly. I
will input different numbers, so make it work with any (I will try very large
numbers too so it should use good logic when deciding how many stars to
place).
-----------------------
This is my current code
TITLE MASM template
Include Irvine32.inc
.data
Intro BYTE "Enter Your five grades: ",0dh,0ah,0
grades DWORD 5 DUP(?)
stars_msg BYTE "*",0
.code
main PROC
;mov edx, offset Intro
;call writestring
call GetGrades
call DisplayStars
exit
main ENDP
GetGrades PROC
mov esi, offset grades
mov ecx, 5 ;counter
input_loop:
mov edx, OFFSET Intro
call WriteString
call ReadInt
mov [esi], eax
add esi, 4 ; next
loop input_loop
ret
GetGrades ENDP
DisplayStars PROC
mov ecx, 5
mov esi, OFFSET grades
DisplayLoop:
mov eax, [esi]
mov ebx, 10
xor edx, edx
div ebx
;mov ecx, edx
call WriteStars
call Crlf
add esi, 4
loop displayLoop
ret
DisplayStars ENDP
WriteStars PROC
mov ecx, eax
starLoop:
mov edx, OFFSET stars_msg
call WriteString
loop starLoop
ret
WriteStars ENDP
END main
 Using MASM irvine32.inc Corrrect my program it runs incorrectly. Your program

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!