标签:
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
unsigned short A =0xABCD;
unsigned short B,C,D;
cout<<setiosflags(ios::uppercase)
<<hex
<<"A =0x "
<<A<<endl;
B = (A<<8)&0xff00;
C = (A>>8)&0x00ff;
D = C|B;
cout<<"B =0x "<<B<<endl
<<"C =0x "<<C<<endl
<<"D =0x "<<D<<endl;
return 0;
}标签:
原文地址:http://blog.csdn.net/chentravelling/article/details/44260161