在VS2017,x86编译环境下:
//编程环境:vs2017 debug x86
//Written by Mr.zs
#include <iostream>
#include <bitset>
#include <stdlib.h>
#include <stdint.h>
using namespace std;
int main()
{
uint64_t a = 18446744073709551615U;
cout << "a_dec = " << dec << a << endl;//10进制
cout << "a_hex = " << hex << a << endl;//16进制
cout << "a_bin = " << bitset<64>(a) << endl;//2进制
system("pause");
return 0;
}
在QT5.3,x86编译环境下:
//编程环境:QT5.3 debug x86
//Written by Mr.zs
#include <iostream>
#include <bitset>
#include <stdlib.h>
#include <stdint.h>
using namespace std;
int main()
{
uint64_t a = 18446744073709551615U;
cout << "a_dec = " << dec << a << endl;//10进制
cout << "a_hex = " << hex << a << endl;//16进制
cout << "a_bin = " << bitset<64>(a) << endl;//2进制
system("pause");
return 0;
}
可以看出在在VS和QT的编译环境下的二进制数是不一样的,但是它们的16进制和10进制是一样的。