New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

再请教一下,如果让2进制和16进制来回转换呢? by shaoyangding #121

Open
freizl opened this Issue Apr 30, 2018 · 1 comment

Comments

Projects
None yet
1 participant
@freizl
Member

freizl commented Apr 30, 2018

import Numeric (showHex, showIntAtBase)
import Data.Char (intToDigit)

putStrLn $ showHex 12 "" -- prints "c"
putStrLn $ showIntAtBase 16 intToDigit 556 "" -- prints "22c"

这样可以把10进制的转换了,有什么方法可以转换2进制到16进制

或者16进制转换成2进制呢?

@freizl freizl added the migration label Apr 30, 2018

@freizl

This comment has been minimized.

Member

freizl commented Apr 30, 2018

先想想,你怎样表示二进制数呢。然后就知道了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment