|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
我自己编的一个程序 要实现从键盘录入200个以上小写英文文章,并把小写文章转换成大写文章输出到屏幕上,同时统计每个字母出现的次数 。现在 可以运行 可是出现Please enter your letters,and press enter to end your input后 输入东西 按回车 只是换行 什么也不出来 大家帮帮忙看看啊
data segment
buffer db 255
db ?
db 255 dup('$')
count db 255 dup(0)
str1 db 'Please enter your letters,and press enter to end your input:','$'
str2 db 0dh,0ah,'The number of chars:','$'
str3 db 0dh,0ah,'You have NOT input any letters','$'
huiche db 0dh,0ah,'$'
data ends
stacks segment
dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
stacks ends
code segment
assume cs:code,ds:data,ss:stacks
start:
main proc near
mov ax,data
mov ds,ax
mov ax,stacks
mov ss,ax
mov ah,09h
mov dx,offset str1
int 21h
call input
mov dx,offset huiche
mov ah,09h
int 21h
call transform
call xianshi
lea bx,buffer
mov ch,0
mov cl,[bx+1]
mov si,0
call jishu1
mov si,0
mov ch,0
mov cl,[bx+1]
call print1
mov ah,4ch
int 21h
main endp
input proc near
push ax
push dx
mov dx,offset buffer
mov ah,0ah
int 21h
pop dx
pop ax
ret
input endp
transform proc near
push ax
push bx
mov bx,3
b20:mov al,ds:[bx]
cmp al,'$'
jz exit
cmp al,'a'
jb b30
cmp al,'z'
ja b30
sub al,20h
mov ds:[bx],al
b30:inc bx
jmp b20
pop bx
pop ax
exit:ret
transform endp
xianshi proc near
push ax
push bx
push cx
push dx
mov bx,4
mov cl,ds:[bx]
cmp cl,24h
jne xs1
mov ah,09h
mov dx,offset str3
int 21h
jmp exit1
xs1:mov ah,09h
mov dx,3
int 21h
pop dx
pop cx
pop bx
pop ax
exit1:ret
xianshi endp
jishu1 proc near
looper:mov di,0
mov al,[bx][si+2]
push cx
push si
mov cx,si
bj: cmp al,[bx][di+2]
je jia
inc di
loopne bj
mov al,count[si]
inc al
mov count[si],al
jmp exit2
jia: mov al,count[di]
inc al
mov count[di],al
exit2:pop si
pop cx
inc si
loopne looper
ret
jishu1 endp
print1 proc near
mov dx,offset str2
mov ah,09h
int 21h
looper1:mov al,0
cmp count[si],al
jne shuchu
ll: inc si
loopne looper1
jmp exit3
shuchu: mov dx,offset huiche
mov ah,09h
int 21h
mov dl,[bx][si+2]
mov ah,02
int 21h
mov dl,count[si]
add dl,30h
cmp dl,39h
jg zhuanhuan
zhuanhuan: push cx
push bx
mov al,count[si]
cbw
mov bl,100
div bl
add al,30h
mov ch,ah
mov ah,02h
mov dl,al
int 21h
mov al,ch
cbw
mov bl,10
div bl
add al,30h
mov ch,ah
mov ah,02h
mov dl,al
int 21h
mov dl,ch
int 21h
pop bx
pop cx
jmp ll
exit3: ret
print1 endp
code ends
end start
|
|