1
私の出力にはいくつか問題があります...私の配列にはいくつか問題があると思います。まだまだ組み立てが新しくなっています。割り当ては、ダイアログボックスを使用してユーザーに番号を入力するアセンブリプログラムを設計することです。これらの数値は配列に格納されます。入力された数字の合計、入力された数字の数(プログラムを終了するために-9999を数えない)、数値の平均、およびそれより大きい配列項目の数を示す出力メッセージが表示されます。平均値に等しい。すべての助けに感謝します!ここで私が持っているものです。アセンブリ内の配列
.DATA
numArray DWORD ?
numElts DWORD 100
num DWORD ?
exitNum DWORD -9999
prompt BYTE "Enter a number", 0
string BYTE 40 DUP (?)
resultLbl BYTE "Results", 0
sum BYTE 11 DUP(?), " is the sum.", 0dh, 0ah
;numEntered BYTE 11 DUP(?), " numbers were entered."
avg BYTE 11 DUP(?), " is the average."
count BYTE 11 DUP(?), " is the number of entries that are >= the average."
.CODE
_MainProc PROC
mov eax, 0 ; sum := 0
lea ebx, numArray ; get address of nbrArray
LOOP1: input prompt, string, 40 ; read ASCII characters
atod string ; convert to integer
mov num, eax ; store in memory
mov ecx, numElts ; count := nbrElts
cmp exitNum, eax
je QUIT ; quit if -9999
add eax, [ebx] ; add number to sum
add ebx, 4 ; get address of next array elt
add ecx, 1 ; add one for count
loop LOOP1 ; repeat nbrElts times
cdq ; extend sum to quadword
idiv numElts ; calculate average
dtoa avg, ebx ; convert to ASCII characters
dtoa count, ecx
dtoa sum, eax
QUIT:
output resultLbl, sum, avg, count
ret
_MainProc ENDP
END ; end of source code
は「atod」カスタム機能ですか?一般的に 'atod'は整数ではなく' double'に変換されます。あなたは 'atol'を望みます。また、あなたの問題が何であるかを説明することで多くの助けになります。 – Necrolis