C++中的bug解决办法

C++中的bug今天小弟我发现了一个错误,我也不知道算不算错误。#include iostream#include iomanip#inclu

C++中的bug
今天小弟我发现了一个错误,我也不知道算不算错误。

#include <iostream>
#include <iomanip>
#include <string>
using namespace std;

int main()
{
  double a;
  cin>>a;
  cout<<hex<<a<<endl;
  cout<<dec<<a<<endl;
  cout<<oct<<a<<endl;
  system("pause");
  return 0;  
}
无论浮点数a为什么数,三个的输出结果都是一样的。

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

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