Bitset

#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<bitset>
using namespace std;


int main(){
    bitset<16>A;
    bitset<16>B(0xfa2);
    bitset<16>C(string("100000"));
    
    cout<<A<<endl;
    cout<<B<<endl;
    cout<<C<<endl;
    
    cout<<(A^=B)<<endl;
    cout<<(A|=B)<<endl;
    cout<<(A^=B)<<endl;
    
    cout<<(A<<=1)<<endl;
    cout<<(A<<1)<<endl;
    cout<<(~A)<<endl;
    
    cout<<(A==B)<<endl;
    cout<<(A!=B)<<endl;
    
    cout<<(A&B)<<endl;
    cout<<(A|B)<<endl;
    
    cout<<A.size()<<endl;
    cout<<A.count()<<endl;
    cout<<A.any()<<endl;
    cout<<A.none()<<endl;
   cout<<A.test()<<endl;

A.
set(); int p=0,x=1; A.set(p); A.set(p,x); A.reset(); A.reset(p); A.flip(); A.flip(p); A.to_ulong(); A.to_string(); return 0; }

 

转载于:https://www.cnblogs.com/zzyer/p/8716241.html

表情包
插入表情
评论将由博主筛选后显示,对所有人可见 | 还能输入1000个字符
相关推荐
©️2020 CSDN 皮肤主题: 编程工作室 设计师:CSDN官方博客 返回首页