fork download
  1. #include <bitset>
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. bitset<4> v1(4);
  8. int res = v1.to_ulong();
  9. cout << res << "\n";
  10. res -= 1;
  11. v1 = bitset<4>(res);
  12. cout << v1.to_ulong() << "\n";
  13. return 0;
  14. }
Success #stdin #stdout 0.01s 2724KB
stdin
Standard input is empty
stdout
4
3