打破二进制数为4位数? [英] Breaking down a binary number into 4 digits?

查看:155
本文介绍了打破二进制数为4位数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用汇编成二进制数分解成4位十进制数。

I need to break down a binary number into 4 decimal digits using assembly.

例如,打破0010 0110 1001 0010这是9874到'9''8''7''4'和显示每一个7段显示器上。我得到的显示部分,我只是不明白其分解的逻辑/流程。

For example, break down 0010 0110 1001 0010 which is 9874 into '9' '8' '7' '4' and show each on a 7-segment display. I got that display part, I just don't understand the logic/process of breaking it down.

谁能帮助吗?

谢谢!

推荐答案

10分,捕捉剩余部分。 (模运算)。推剩余到堆栈或其它合适的结构。重复,直到商为0。你推的余数数字值。

divide by 10, capturing the remainder. (modulus operation). Push the remainder onto a stack or other suitable structure. Repeat until the quotient is zero. The remainders that you pushed are the digit values.

这篇关于打破二进制数为4位数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆