Answers for "binary number in cpp"

C++
2

built in function in c++ for binary to decimal

#include <bits/stdc++.h>

using namespace std;

int main(void){
    bitset<8> bits("1000");
    int ab = bits.to_ulong();
    cout << ab << "n";
    
    return 0;
}
Posted by: Guest on May-15-2020
0

binary representation c++

#include <bitset>
...

char a = -58;
std::bitset<8> x(a);
std::cout << x << 'n';

short c = -315;
std::bitset<16> y(c);
std::cout << y << 'n';
Posted by: Guest on August-16-2021

Browse Popular Code Answers by Language