data segment
string db "in 1990,the exchange rate was 8.1/$"
strend db ?
num db 0
char db 0
other db 0
data ends
code segment
assume cs:code,ds:data
start:mov ax,data
mov ds,ax
mov si,offset string
mov cx,strend-string
continue:mov dl,[si]
cmp dl,30h
jl l1
cmp dl 39h
jl l2
cmp dl 41h
jl l1
cmp dl 5ah
jl l3
cmp dl 61h
jl l1
cmp dl 7ah
jl l3
inc other
jmp next
l1:INC other
jmp next
l2:inc num
jmp next
l3:inc char
jmp next
next:inc si
loop continue
mov ah,4ch
int 21h
code ends
end start
------最佳解决方案--------------------------------------------------------
这样就ok了,注意打印的字符要小于10 才能正确打印
data segment
string db "in 1990,the8.1/$"
strend db ?
num db 0
char db 0
other db 0
data ends
code segment
assume cs:code,ds:data
start:mov ax,data
mov ds,ax
mov si,offset string
mov cx,strend-string
continue:mov dl,[si]
cmp dl,30h
jl l1
cmp dl,3ah
jl l2
cmp dl,41h
jl l1
cmp dl,5bh
jl l3
cmp dl,61h
jl l1
cmp dl,7bh
jl l3
inc other
jmp next
l1:INC other