编译器:Microsoft Visal studio C++6.0

代码段内容:

union Def_float
{

    float value;

    struct 

    {
    BYTE by_0; // 最低字节 
    BYTE by_1;
    BYTE by_2;
    BYTE by_3; // 最高字节
   };
};

Def_float temp;
temp.value = atof("0");
CString strT;
strT.Format("%X",temp.by_3);
AfxMessageBox(strT);  // 输出 00

 

temp.value = atof("-0");
strT.Format("%X",temp.by_3);
AfxMessageBox(strT); //输出 80

Def_float temp2;
temp2.value = -0;
strT.Format("%X",temp2.by_3);
AfxMessageBox(strT); //输出 00

 

 

相关文章:

  • 2021-08-04
  • 2022-12-23
  • 2021-11-30
  • 2022-02-17
  • 2022-02-26
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-08
  • 2022-12-23
  • 2022-12-23
  • 2021-04-24
  • 2021-11-27
  • 2021-11-21
  • 2022-12-23
相关资源
相似解决方案