std::bitset
来源:互联网 发布:把app软件绿色版 编辑:程序博客网 时间:2024/05/29 04:35
// std_string.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <string>
#include <iostream>
#include <fstream>
#include <bitset>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
bitset<16> bitvec1(0xffff);//0-15为1
bitset<32> bitvec2(0xffff); //0-15为1,16—31为0
bitset<128> bitvec3(0xffff); //0-31为1,32-127为0
string str("1100");
bitset<32> bitvec4(str); //反向转换:bitec4:0011
string str1("1111111000000011001101");
bitset<32> bitevec5(str1,5,4); //4 bit starting at str1[5],1100
bitset<32> bitvec6(str1,str1.size()-4) //using last 4 bits
cout<<bitvec2[16];
return 0;
}
//
#include "stdafx.h"
#include <string>
#include <iostream>
#include <fstream>
#include <bitset>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
bitset<16> bitvec1(0xffff);//0-15为1
bitset<32> bitvec2(0xffff); //0-15为1,16—31为0
bitset<128> bitvec3(0xffff); //0-31为1,32-127为0
string str("1100");
bitset<32> bitvec4(str); //反向转换:bitec4:0011
string str1("1111111000000011001101");
bitset<32> bitevec5(str1,5,4); //4 bit starting at str1[5],1100
bitset<32> bitvec6(str1,str1.size()-4) //using last 4 bits
cout<<bitvec2[16];
return 0;
}
- std::bitset
- std::bitset
- B00003 C++标准库 std::bitset
- 使用std::bitset容器将字符转换成二进制形式
- error C2039: 'bitset' : is not a member of 'std'
- bitset
- bitset
- BitSet
- bitset
- bitset
- BitSet
- bitset
- bitset
- bitset
- bitset
- bitset
- BitSet
- bitset
- JS/css代码在IE和Firefox间的区别
- 通过代码实现button的点击效果
- 对我的生活吐吐槽
- Ibatis使用事务
- linux安装git
- std::bitset
- Struts + Spring + Hibernate集成
- 阻止IE弹出“在此页上的 ActiveX 控件和本页上的其他部份的交互可能不安全。你想允许这种交互吗?”对话框
- 计算机图形学到底讲了什么
- Task在TaskTracker上执行环境的准备
- 个人想法
- cmake 学习笔记(一)
- Spring 各模块
- creat a bingo card(二)