template<class XCharType, class XTraits, class XAlloc> basic_string<XCharType, XTraits, XAlloc> bitset<N>::to_string() const;
#include <bitset>
#include <bitset>
#include <iostream>
#include <string>
int main()
{
using namespace std;
// Create a bitset
bitset<4> qBits(5);
cout << "bitset<4> : "<< qBits << endl;
// Output the string representation
string sBits;
sBits = qBits.to_string<char, char_traits<char>, allocator<char> >();
cout << "The string is " << sBits << endl;
// Keep the window open
cin.get();
return 0;
}
© 20072025 XoaX.net LLC. All rights reserved.