Skip to content
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
Open
Labels

Comments

@freizl
Copy link
Member

@freizl 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
Copy link
Member Author

@freizl freizl commented Apr 30, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.