- Assembly code
start: mov ax,data mov ds,ax ;input code segment code here mov ah,01h;//input a character int 21h ;sub al,'0';//input into al mov dh,al mov dl,al and dh,0f0h shr dh,1 shr dh,1 shr dh,1 shr dh,1 and dl,0fh add dh,30 add dl,30 mov ah,02h;//output int 21h mov dl,dh int 21h
程序运行的时候,我输入一个A,希望输出31
我的程序错在哪里呢?
------解决方案--------------------------------------------------------
add dh,30h
add dl,30h
------解决方案--------------------------------------------------------
写个 进制转换的 子程序吧。
当大于9的时候,LZ没考虑。