c语言sscanf函数的用法是什么
244
2022-08-27
案例5数字方阵程序
该程序实现显示一个数字的方阵,程序中的清屏功能可将上次运行的结果 清除,重新显示下次运行结果。本程序在dos中或windows98中运行。
汇编代码:
data segmentbuf1 db '1 2 38 9 47 6 5'buf2 db '1 2 3 412 13 14 511 16 15 610 9 8 7'buf3 db '1 2 3 4 516 17 18 19 615 24 25 20 714 23 22 21 813 12 11 10 9'dbuf db 14 dup(?)i1 db 0dh,0ah,'this is a fangzhen programme' db 0dh,0ah,'input q to exit' db 0dh,0ah,'Please input a number(3--5):','$'i2 db 0dh,0ah,'input error,please reinput!','$'n db ?b db 1data endsstack segment db 100 dup(?)stack endscode segment assume ds:data,cs:code,ss:stackmain: mov ax,data mov ds,ax call clearlop: lea dx,i1 mov ah,9 int 21h mov ah,1 int 21h cmp al,'q' jz quit lea si,buf1 mov n,7 mov cl,3 call clear cmp al,'3' jz s lea si,buf2 mov n,10 mov cl,4 cmp al,'4' jz s lea si,buf3 mov cl,5 mov n,13 cmp al,'5' jz s lea dx,i2 mov ah,9 int 21h call clear jmp lops: mov bl,n lea di,dbufl: mov al,[si] mov [di],al inc si inc di dec bl jne l mov [di],byte ptr '$' mov ah,2 mov dh,b mov dl,0 int 10h lea dx,dbuf mov ah,9 int 21h inc b loop s jmp lopquit: mov ah,4ch int 21h;***清屏***clear proc near push ax push bx push cx push dx mov ah,6 mov al,0 mov ch,0 mov cl,0 mov dh,24 mov dl,79 mov bh,7 int 10h pop dx pop cx pop bx pop ax retclear endpcode ends end main
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~