| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 3408 人关注过本帖
标题:十六进制的地址为什么要00开头而不是0x?
只看楼主 加入收藏
maxlea
Rank: 1
等 级:新手上路
帖 子:62
专家分:0
注 册:2006-12-7
收藏
 问题点数:0 回复次数:6 
十六进制的地址为什么要00开头而不是0x?


#include <iostream>
using namespace std;
int main()
{
int a=10;
double b=10.11;
cout << \"The value of a is \" << a << \" and the address of a is \" << &a << endl ;
cout << \"The value of b is \" << b << \" and the address of b is \" << &b << endl ;
return 0;
}

搜索更多相关主题的帖子: 十六进制 地址 
2007-01-25 17:32
一二三四五
Rank: 3Rank: 3
等 级:新手上路
威 望:8
帖 子:856
专家分:0
注 册:2006-11-13
收藏
得分:0 
不是十六进制,当然就不是0x开头了

hey,di va la
2007-01-25 19:11
tyc611
Rank: 1
等 级:新手上路
帖 子:83
专家分:0
注 册:2007-1-21
收藏
得分:0 

你程序输出会00头?深表怀疑^_^


2007-01-25 23:15
醉生梦死
Rank: 1
等 级:新手上路
帖 子:77
专家分:0
注 册:2007-8-21
收藏
得分:0 
我试过,是以ox头的

2007-08-27 13:26
valentineyzq
Rank: 1
等 级:新手上路
威 望:1
帖 子:69
专家分:0
注 册:2007-8-21
收藏
得分:0 
我试过了,是以00开头的。我的机子上的16进制都是00开头。这是系统的差别吧?我觉得不碍事。

我的世界曾经下过一场倾盆大雨。
2007-08-29 22:43
天使梦魔
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:37
帖 子:564
专家分:2754
注 册:2007-8-29
收藏
得分:0 
一样的,表示方法不同。
你多用用十六进制文本编辑器就知道了。
00就代表0*
如果要看整数型就用强制转换看看一不一样。
cout << "The value of a is " << a << " and the address of a is " << int(&a) << endl ;
cout << "The value of b is " << b << " and the address of b is " << int(&b) << endl ;
2007-08-30 08:46
HJin
Rank: 6Rank: 6
等 级:贵宾
威 望:27
帖 子:401
专家分:0
注 册:2007-6-9
收藏
得分:0 

#include <iostream>
using namespace std;
int main()
{
int a=10;
double b=10.11;

cout << "The value of a is " << a << " and the address of a is "<<hex<<showbase<< (int)(&a) << endl ;
cout << "The value of b is " << b << " and the address of b is " << &b << endl ;


return 0;
}

/** Output from VC 2005:

The value of a is 10 and the address of a is 0x12ff68
The value of b is 10.11 and the address of b is 0012FF6C
Press any key to continue . . .

Suggestion: if you want to show the base of a number, you may want to use
the io manipulators showbase or noshowbase, etc.

*/


I am working on a system which has no Chinese input. Please don\'t blame me for typing English.
2007-08-30 09:28
快速回复:十六进制的地址为什么要00开头而不是0x?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.013830 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved