#include "pch.h" #include <iostream> #include<Windows.h> int main() { int i = 10241035; WORD ih = HIWORD(i);//取高16位,变为32位 WORD il = LOWORD(i);//取低16位 //return:9c std::cout << std::hex << "i的高位" << ih << std::endl; //return:440b std::cout << std::hex << "i的低位" << il << std::endl; WORD bh = HIBYTE(i);//取高8位,变为16位 WORD bl = HIBYTE(i);//取得低8位 std::cout << std::hex << "i的高位" << bh << std::endl; std::cout << std::hex << "i的低位" << bl << std::endl; return EXIT_SUCCESS; }
原文地址:https://www.cnblogs.com/chuxinbubian/p/10739486.html
时间: 2024-11-14 17:08:21