求 40bit数据分割为10bit数据方法!60分!!
本帖最后由 longneicool 于 2013-10-25 10:40:35 编辑
1001000010 100100000 0100000001 0100000000
#include "stdafx.h"
#include<iostream>
#include <stdio.h>
#include <bitset>
using namespace std;
int main()
{
bitset<10> b=0x2ab;
for(int i=0;i<2;i++)
{
bitset<5> temp;
for(int j=0;j<5;j++)
{
temp[j]=b[5*i+j];
}
cout<<temp.to_ulong()<<endl;
}
return 0;
}