#include<iostream> #include<bitset> #include<stdexcept> //vc中不要这个也能通过 using namespace std; int main() { bitset<100> bs; for(size_t ix = 0; ix != bs.size(); ++ix) { bs[ix] = 1; } try { bs.to_ulong();//将bs转化为unsigned long 类型 } catch(runtime_error err) { cout << "err!!!" << endl; cout << err.what() << endl; } return 0; }
您还没有登录,请您登录后再发表评论
评论