久久国产成人av_抖音国产毛片_a片网站免费观看_A片无码播放手机在线观看,色五月在线观看,亚洲精品m在线观看,女人自慰的免费网址,悠悠在线观看精品视频,一级日本片免费的,亚洲精品久,国产精品成人久久久久久久

分享

匯編:統(tǒng)計輸入字符串內(nèi)的數(shù)字個數(shù)(最多三位數(shù)0—256)

 共同成長888 2015-07-18
;This is made by wq  
;編程從鍵盤讀入不超過256個字符的字符串;
;編程統(tǒng)計其中數(shù)字的個數(shù),,并將結(jié)果在屏幕上輸出,。
;經(jīng)進一步完善(能輸出三位數(shù)啦)


DATAS SEGMENT
    sum    db 00h    ;累加器 
    string db 256 dup(0dh);存放字符
    tital  db  'This program is made by wq.',0dh,0ah
           db  'It is used to calculater the amout of the number in the string ',0dh,0ah,'$'
    tital1 db  'PLease input the string: ','$'
    overs  db  'Amout of the nember is : ','$'
    tital2 db  'Do you want to have a try again(if yes,input "y" else "n") : ',0dh,0ah, '$'
    tital3 db  'Welcome to use this program again','$'
    kongzi db 0dh,0ah,'$'
    result db 256 dup(?)   
DATAS ENDS
CODES SEGMENT
    ASSUME CS:CODES,DS:DATAS
START:
    MOV AX,DATAS
    MOV DS,AX
   
    mov ax,offset tital;輸出抬頭
    mov dx,ax
    mov ah,09h
    int 21h
main:
       lea dx,kongzi
       mov ah,09h
       int 21h
       lea dx,tital1   ;輸出抬頭1
       mov ah,09h
       int 21h
   
    mov si,0
    mov ax,offset string
    mov dx,ax
again:           ;輸入字符
    mov ah,01h
    int 21h
    cmp al,0dh
    jz then
    mov string[si],al
    inc si
    jmp again    ;輸入完畢
then:          ;傳輸
    mov di,0     
    mov si,0
    mov bl,0
exchang:              ;判斷字符的性質(zhì)
     lea dx,string
     cmp string[si],0dh    
     jz over
     cmp string[si],30h
     jnb next
     inc si
    dec cx
    jmp exchang
next:                      
    mov al,string[si]
    cmp string[si],39h 
    jbe calculator
    inc si
    dec cx
    jmp exchang
  
calculator:
     lea dx,result
     mov result[di],al
    inc si
    inc sum
    inc di
    dec cx
    jmp exchang   
over:                   ;處理并輸出數(shù)字個數(shù)
   lea dx,overs
   mov ah,09h
   int 21h
  mov ax,0000h
  mov al,sum[0]         ;判斷是否為三位數(shù)
  cmp al,64h
  jae san
  mov bl,10
  div bl
  mov dx,ax
  add dx,3030h
   mov ah,02h
   int 21h
   mov dl,dh
   mov ah,02h
    int 21h
    jmp a
san: mov bl,10          ;如果是三位數(shù)則多處理一位
     div bl
     mov cl,ah          ;把第一位給cl
     add cl,30h
     mov ah,00h
     div bl              ;第二次除十
     mov dx,ax       
     add dx,3030h
     mov ah,02h
     int 21h
     mov dl,dh
     mov ah,02h
     int 21h
     mov dl,cl
     mov ah,02h
     int 21h    
    
a:  lea dx,kongzi     
    mov ah,09h            ;判斷是否循環(huán)操作
    int 21h 
    lea dx,tital2
    mov ah,09h
    int 21h
    mov ah,01h
    int 21h
   
    cmp al,'y'
    je main
    lea dx,tital3
    mov ah,09h
    int 21h
        
    MOV AH,4CH
    INT 21H
CODES ENDS
    END START

    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,,所有內(nèi)容均由用戶發(fā)布,,不代表本站觀點,。請注意甄別內(nèi)容中的聯(lián)系方式,、誘導(dǎo)購買等信息,謹(jǐn)防詐騙,。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,,請點擊一鍵舉報。
    轉(zhuǎn)藏 分享 獻花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多