把01000000转化成10进制数为多少怎么转化

m_leaner 2004-04-09 01:17:34
把01000000转化成10进制数为多少怎么转化
...全文
520 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
meneter 2004-04-09
  • 打赏
  • 举报
回复
你得掌握其二进制转换成十进制的原理
01000000 = 0*2^7 + 1*2^6 + 0*2^5 + 0*2^4 + 0*2^3 + 0*2^2 + 0*2^1 + 0*2^0
madyak 2004-04-09
  • 打赏
  • 举报
回复
先转换成十六进制
Converts a binary value into its hexadecimal representation.

Unit

Classes

Category

type conversion routines

procedure BinToHex(Buffer, Text: PChar; BufSize: Integer);

Description

Call BinToHex to convert the binary value in a buffer into a string that is its hexadecimal representation.

Buffer is a buffer of bytes that contains the binary value.

Text returns a null-terminated string that represents the value of Buffer as a hexadecimal number.

BufSize is the size of Buffer. Text needs to point to a sequence of characters that has at least 2*BufSize bytes because each hexadecimal character represents two bytes

再将十六进制转换为10进制

Converts a string that represents an integer (decimal or hex notation) to a number.

Unit

SysUtils

Category

type conversion routines

function StrToInt(const S: string): Integer;

Description

StrToInt converts the string S, which represents an integer-type number in either decimal or hexadecimal notation, into a number. If S does not represent a valid number, StrToInt raises an EConvertError exception.
zblaoshu1979 2004-04-09
  • 打赏
  • 举报
回复
64
function BinToInt(Value: string): Integer;

var

i, iValueSize: Integer;

begin

Result := 0;

iValueSize := Length(Value);

for i := iValueSize downto 1 do

if Value[i] = '1' then Result := Result + (1 shl (iValueSize - i));

end;

5,386

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧