bitset使用

简介: 17.10使用序列1、2、3、5、8、13、21初始化一个bitset,将这些位置置位。对另一个bitset进行默认初始化,并编写一小段程序将其恰当的位置位。 #include #include using namespace std; int main() { bitset...

17.10使用序列1、2、3、5、8、13、21初始化一个bitset,将这些位置置位。对另一个bitset进行默认初始化,并编写一小段程序将其恰当的位置位。

#include<iostream>
#include<bitset>
using namespace std;
int main()
{
    bitset<32> bits("100000001000010010111");
    bitset<32> bit;
    bit.set(1);
    bit.set(2);
    bit.set(3);
    bit.set(5);
    bit.set(8);
    bit.set(13);
    bit.set(21);
}

 

相关文章
|
1月前
|
存储 算法 数据安全/隐私保护
C++ 位运算 std::bitset类的使用介绍
C++ 位运算 std::bitset类的使用介绍
17 0
|
6月前
|
算法 固态存储 数据处理
位图(bitset)的使用【STL】
位图(bitset)的使用【STL】
23 1
|
6月前
|
C++ 容器
bitset(C++实现)
bitset(C++实现)
37 0
|
6月前
|
存储 Java C++
unordered_set和unordered_map的使用【STL】
unordered_set和unordered_map的使用【STL】
140 0
|
9月前
|
存储
BitSet—位图
BitSet—位图
|
11月前
|
算法 C++ 容器
STL之vector
STL之vector
|
存储 C++ 容器
【C++】-- STL之unordered_map/unordered_set详解(二)
【C++】-- STL之unordered_map/unordered_set详解
【C++】-- STL之unordered_map/unordered_set详解(二)
|
C++ 容器
【C++】-- STL之unordered_map/unordered_set详解(三)
【C++】-- STL之unordered_map/unordered_set详解
【C++】-- STL之unordered_map/unordered_set详解(三)
|
存储 C++ 索引
【C++】-- STL之unordered_map/unordered_set详解(一)
【C++】-- STL之unordered_map/unordered_set详解
282 0
【C++】-- STL之unordered_map/unordered_set详解(一)