Answers for "c++ cast bitset to string"

C++
1

how to put bitset into a string in c++

#include <iostream>
#include <bitset>
int main()
{
    std::bitset<8> b(42);
    std::cout << b.to_string() << 'n'
              << b.to_string('*') << 'n'
              << b.to_string('O', 'X') << 'n';
}
Posted by: Guest on February-10-2021

Browse Popular Code Answers by Language