datarea segment
string1 db 82 dup(?)
letter db 0
digit db 0
other db 0
datarea ends
prognam segment
main proc far
assume cs:prognam,ds:datarea
start:
push ds
sub ax,ax
push ax
mov ax,datarea
mov ds,ax
lea bx,string1
mov dx,bx
mov al,80
mov [bx],al
mov ah,0ah
int 21h
inc bx
mov cl,[bx]
begin_:
inc bx
mov al,[bx]
cmp al,30h
jl other_
cmp al,3ah
jl digit_
cmp al,41h
jl other_
cmp al,5bh
jl letter_
cmp al,61h
jl other_
cmp al,7bh
jl letter_
other_:
inc other
jmp lp_
letter_:
inc letter
jmp lp_
digit_:
inc digit
lp_:
loop begin_
mov ah,02h
mov dl,0ah
int 21h
mov dl,0dh
int 21h
mov dl,letter
call output
mov dl,digit
call output
mov dl,other
call output
ret
main endp
output proc near
add dl,30h
int 21h
mov dl,20h
int 21h
int 21h
ret
output endp
prognam ends
end start
letter是英文字符的个数
digit是数字字符的个数
other是其它字符的个数
三个加起来就是字符串长度
温馨提示:内容为网友见解,仅供参考