Home » C++ Programming » Questions and Answers » Question
  1. What is the output of this program?
     #include <iostream>
    #include <string>
    #include <bitset>
    using namespace std;
    int main ()
    {
    string Str;
    bitset<5> BitsetData;
    BitsetData.set();
    Str = BitsetData.to_string<char, char_traits<char>,
    allocator<char> >();
    cout << Str ;
    return 0;
    }
    1. 1
    2. 11
    3. 111
    4. 1111
    5. 11111
Correct Option: E

In this program, We converted the bitset values to string and printing it.



Your comments will be displayed only after manual approval.