64,639
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
using namespace std;
void main()
{
int i,j;
unsigned int a[4]={1, 4, 3, 2};//改 unsigned int a[2]={0x0302,0x0104};/存放的是输出的数据01 04 03 02
unsigned int A = 0xffff;
for(i=0; i<4; i++) //改 for(i=0; i<2; i++)
{
A = A ^ a[i];
for(j=0; j<8; j++)
{
if(A & 1)
{
A >>= 1;
A ^= 0xa001;
}
else A >>= 1;
}
//改 a[i++];
}
A = (A >> 8) + ((A & 0xff) << 8); //加
cout << "0X" << hex << A << endl; //改 cout<<A<<endl;
}