Horje
c++ display numbers as binary Code Example
c++ display numbers as binary
#include <iostream>
#include <bitset>

int main() {
    int a = -58, b = a>>3, c = -315;

    std::cout << "a = " << std::bitset<8>(a)  << std::endl;
    std::cout << "b = " << std::bitset<8>(b)  << std::endl;
    std::cout << "c = " << std::bitset<16>(c) << std::endl;
}
c++ print byte as bit
#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';




Cpp

Related
check if double is integer c++ Code Example check if double is integer c++ Code Example
std string to const char * c++ Code Example std string to const char * c++ Code Example
or in cpp Code Example or in cpp Code Example
get an array with c++ Code Example get an array with c++ Code Example
Heap pinter c++ Code Example Heap pinter c++ Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
9