利用BITSET+STRING就可以了:
例如
例如
1 #include <iostream> 2 #include <bitset> 3 #include <string> 4 5 using namespace std; 6 7 int main() 8 { 9 string str="1101001010"; 10 bitset<32> b(str); 11 int n; 12 n=b.to_ulong(); 13 14 cout<<n; 15 16 return 0; 17 }