Okay so I working on this program where I have to input a string and then display the character distribution in that string.
if the input is “minecode” the output should be
C – 1
O – 1
D – 1
E – 2
I – 1
M – 1
N – 1
here is what I tried to do but I really don't know how to traverse the loop and check for similar character and then increment the count. Please help me out! The assenbler is MASM 6.15 running on 32 bit machine.
.686 .MODEL flat, stdcall .STACK INCLUDE Irvine32.inc .DATA msg0 BYTE "Enter a string of characters: ",0 msg1 BYTE "Character Distribution: ",0 MainArray dword 10000 dup (?) UniqueChar dword 10000 dup (?) CharCount dword 10000 dup (?) .CODE MAIN PROC lea edx, msg0 call WriteString call dumpregs ; 1 call ReadString mov MainArray, eax call dumpregs ; 2 mov MainArray, ebx call dumpregs ; 3 call CRLF lea edx, msg1 call WriteString call CharDist ; Calls the procedure call dumpregs ; 5 exit MAIN ENDP CharDist PROC mov ecx, lengthof MainArray mov esi, OFFSET MainArray L1: ; what to do here?? Loop L1: CharDist ENDP END MAIN
Edited 6 Years Ago by vista: n/a