Hey! Well I'm writing a program that will take a given number of grades(90%,77%,36%, etc) and once the user types a negative number to stop, it will output the total for each, so for the grade I wrote above, it would show:
Everything works fine, but when I use the sentinel to get my final totals, they all have weird smiley face guys, followed by a "-1". I put a screen shot here:http://i31.tinypic.com/34ou000.jpg
Here is the code:
; a program that takes the numbers of grades and returns the total of each
; date: 8/11/09
ExitProcess PROTO NEAR32 stdcall, dwExitCode:DWORD
cr EQU 0dh ; carridage return character
Lf EQU 0ah ; linefeed character
.STACK 4096 ; reserve 4096-byte stack
prompt1 BYTE cr,Lf,Lf,"Please enter the grade. Enter - to exit and get your total: ", 0
ACount BYTE ?
BCount BYTE ?
CCount BYTE ?
DCount BYTE ?
FCount BYTE ?
gradeIn BYTE 20 DUP (?)
AOut BYTE cr,Lf,Lf, "Total number of A's: ", 0
BOut BYTE cr,Lf, "Total number of B's: ", 0
COut BYTE cr,Lf, "Total number of C's: ", 0
DOut BYTE cr,Lf, "Total number of D's: ", 0
FOut BYTE cr,Lf, "Total number of F's: ", 0
.CODE ; start main code
whileGrade: output prompt1
gradeDecide: cmp eax, 90
cmp eax, 80
cmp eax, 70
cmp eax, 60
ifA: inc ACount
iffB: inc BCount
ifC: inc CCount
ifD: inc DCount
ifF: inc FCount
endGrade: output AOut
endCode: INVOKE ExitProcess, 0
Also, random, but is 'ifb' a mnemonic? I had to change it to 'iffB' because it wouldn't accept 'ifB'.