POJ 3748 位操作 C++

来源:互联网 发布:vmware桥接网络不通 编辑:程序博客网 时间:2024/06/09 14:29

#include <iostream>using namespace std;int main(){int a;int b;int c;char d;cin>>hex>>a>>d>>dec>>b>>d>>c;//读取的是十进制 //cout<<hex<<c<<endl;int pp;pp=1;pp=pp<<b;pp=~pp;a=a&pp;//cout<<hex<<a<<endl;int mm=6;mm=mm<<(c-2);//cout<<hex<<mm<<endl;int temp=7;temp=temp<<(c-2);temp=~temp;a=a&temp;//cout<<hex<<a<<endl;a=a|mm;cout<<hex<<a<<endl;//cout<<a<<" "<<b<<" "<<c<<endl;//cout<<d;return 0;} 

0 0
原创粉丝点击