Files
Victor Eijkhout 6e41c0447e missing files
2023-08-16 19:14:29 -05:00

29 lines
692 B
C++

/****************************************************************
****
**** This file belongs with the course
**** Introduction to Scientific Programming in C++/Fortran2003
**** copyright 2023 Victor Eijkhout eijkhout@tacc.utexas.edu
****
**** bitset.cxx : bitwise operators
****
****************************************************************/
#include <iostream>
using std::cin, std::cout;
#include <bitset>
using std::bitset;
int main() {
//codesnippet bitsetandor
bitset<8> xb(6);
bitset<8> yb(3);
auto xory = (xb|yb).to_ulong();
cout << "6|3 = " << (xb|yb) << " = "
<< xory << '\n';
cout << "6&3 = " << (xb&yb) << '\n';
//codesnippet end
return 0;
}