网页资讯视频图片知道文库贴吧地图采购
进入贴吧全吧搜索

 
 
 
日一二三四五六
       
       
       
       
       
       

签到排名:今日本吧第个签到,

本吧因你更精彩,明天继续来努力!

本吧签到人数:0

一键签到
成为超级会员,使用一键签到
一键签到
本月漏签0次!
0
成为超级会员,赠送8张补签卡
如何使用?
点击日历上漏签日期,即可进行补签。
连续签到:天  累计签到:天
0
超级会员单次开通12个月以上,赠送连续签到卡3张
使用连续签到卡
12月30日漏签0天
汇编吧 关注:45,335贴子:164,111
  • 看贴

  • 图片

  • 吧主推荐

  • 游戏

  • 1回复贴,共1页
<<返回汇编吧
>0< 加载中...

比较输入的两个字符串

  • 只看楼主
  • 收藏

  • 回复
  • wesonz
  • 位运算
    11
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
data segment
string1 db 50,50 dup(?)
string2 db 50,50 dup(?)
show1 db 'please input the first string: (press enter to end) ',0ah,0dh,'$'
show2 db 0ah,0dh,'please input the second string: (press enter to end) ',0ah,0dh,'$'
result1 db 'match!!!$'
result2 db 'notmatch!!!$'
data ends
stack segment
db 100 dup(?)
stack ends
code segment
ASSUME CS:CODE,DS:DATA,SS:STACK
start:
push ds
sub ax,ax
push ax
mov ax,data
mov ds,ax
mov ah,9
mov dx,offset show1
int 21h
mov cx,-1
for1: ;键盘输入字符存入string1中
mov ah,1
int 21h
mov di,offset string1
mov [di],al
inc di
inc cx
cmp al,0dh
jne for1
push cx ;保存string1的长度
mov ah,9
mov dx,offset show2
int 21h
mov cx,-1
for3: ;键盘输入字符存入string2中
mov ah,1
int 21h
mov di,offset string2
mov [di],al
inc di
inc cx
cmp al,0dh
jne for3
push cx ;保存string2的长度
mov ah,2
mov dl,0dh
int 21h
mov ah,2
mov dl,0ah
int 21h
pop cx ;second string length
pop bx ;first string length
cmp bx,cx
je substring
notmatch:
mov ah,9
lea dx,result2
int 21h
jmp ended
substring:
mov si,offset string1
mov di,offset string2
lop:
mov al,[si]
mov bl,[di]
cmp bl,al
jnz notmatch
inc si
inc di
loop lop
mov ah,9
lea dx,result1
int 21h
ended:
mov ah,4ch
int 21h
code ends
end


  • wesonz
  • 位运算
    11
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
求大神帮忙看下哪里出了问题,键盘输入两个字符串,如果相同输入match,不同输出notmatch。。谢谢了


登录百度账号

扫二维码下载贴吧客户端

下载贴吧APP
看高清直播、视频!
  • 贴吧页面意见反馈
  • 违规贴吧举报反馈通道
  • 贴吧违规信息处理公示
  • 1回复贴,共1页
<<返回汇编吧
分享到:
©2025 Baidu贴吧协议|隐私政策|吧主制度|意见反馈|网络谣言警示