cout控制格式输出有关问题

cout控制格式输出问题
1. unsigned char c=0;
cout<<setw(2)<<hex<<0;
这样正常显示一个0,但是 cout<<setw(2)<<hex<<c;什么也不显示,这个是为什么?

2.想以16进制的形式按字节显示一个浮点数的各个字节,c语言实现如下
C/C++ code

void print(unsigned char* p,int count)
{
    for(int i=0;i<count;i++)
    {
        printf("%.2x",p[i]);
        //cout<<setw(2)<<hex<<p[i]<<"    ";
    }
}


C++实现的话怎么写那个cout语句呢?

------解决方案--------------------
hex,dec,oct只能用做整形之类的。
浮点数要用其他方式:

http://blog.sina.com.cn/s/blog_4118ac240100s7ei.html

------解决方案--------------------
cout<<setw(2)<<hex<<c;这个不显示,是因为hex只对整型一类的有用(整型占4个字节),
你的c是unsigned char(占一个字节)。