Contact: aviboots(AT)netvision.net.il
38,636 questions
50,322 answers
573 users
#include <iostream> #include <bitset> int main(void) { std::string binary = "11110101"; unsigned long decimal = std::bitset<8>(binary).to_ulong(); std::cout << decimal; } /* run: 245 */
#include <iostream> #include <bitset> int main(void) { std::bitset<8> bits("11110101"); unsigned long decimal= bits.to_ulong(); std::cout << decimal; } /* run: 245 */