0

I need help with this program. It take in a number from the user and displays their grade. For example. If the user inputs 77. The program prints out "Your grade is a C"

jmp firstLine  ;

    m1 dw ?

    prompt db 'Enter a number between 1 to 100: '
    promptLen = $-prompt

    gradeA db 'Your grade is an A'
    gradeALen = $-gradeA

    gradeB db 'Your grade is an B'
    gradeBLen = $-gradeB

    gradeC db 'Your grade is an C'
    gradeCLen = $-gradeC

    gradeD db 'Your grade is an D'
    gradeDLen = $-gradeD

    gradeF db 'Your grade is an F'
    gradeFLen = $-gradeF



    firstLine:

    mov si, offset prompt
    mov cx, promptLen
    call putStrng
    call getDec
    mov m1, ax
    call crlf


.IF m1 >=90
    mov si, offset gradeA
    mov cx, gradeALen
    call putStrng
.ELSEIF (m1 <= 89) && (m1 > 80)
    mov si, offset gradeB
    mov cx, gradeBLen
    call putStrng
.ELSEIF (m1 <= 79) && (m1 > 70)
    mov si, offset gradeC
    mov cx, gradeCLen
    call putStrng
.ELSEIF (m1 <= 69) && (m1 > 60)
    mov si, offset gradeD
    mov cx, gradeDLen
    call putStrng
.ELSEIF (m1 <= 59)
    mov si, offset gradeF
    mov cx, gradeFLen
    call putStrng
.ENDIF

    mov ah, 04c
    int 021
2
Contributors
1
Reply
2
Views
4 Years
Discussion Span
Last Post by hr.Ziggurat
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.